-
Notifications
You must be signed in to change notification settings - Fork 0
/
kh-scheduler.js
executable file
·112 lines (96 loc) · 2.33 KB
/
kh-scheduler.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
#!/usr/bin/env node
// Chmod 777 kh-scheduler.js
const program = require('commander');
const {
addWorkerUsingTerminal,
addWorkerRoleUsingTerminal,
addRoleUsingTerminal,
addTimeOffUsingTerminal,
newScheduleUsingTerminal,
listWorkersUsingTerminal,
findWorkersUsingTerminal,
listRoles,
getCurrentScheduleUsingTerminal
} = require('./services/terminal');
program
.version('1.0.0')
.description('Schedule Generator');
program
.command('add-role')
.alias('ar')
.description('add a role')
.action(() => {
addRoleUsingTerminal();
});
program
.command('list-roles')
.alias('lr')
.description('get the full list of roles')
.action(() => {
listRolesUsingTerminal();
});
program
.command('add-worker')
.alias('aw')
.description('add a worker')
.action(() => {
addWorkerUsingTerminal();
});
program
.command('find-worker <name>')
.alias('fw')
.description('get worker by name')
.action((name) => {
findWorkersUsingTerminal(name);
});
program
.command('list-workers')
.alias('lw')
.description('get the full worker list')
.action(() => {
listWorkersUsingTerminal();
});
program
.command('new-schedule')
.alias('ns')
.description('create a new schedule')
.action(() => {
newScheduleUsingTerminal();
});
program
.command('current-schedule')
.alias('gcs')
.description('get the current schedule')
.action(() => {
getCurrentScheduleUsingTerminal();
});
program
.command('export-schedules <month>')
.alias('es')
.description('export the schedules for a given month')
.action((month) => {
exportSchedulesUsingTerminal(month);
});
program
.command('set-worker-roles <workerid>')
.alias('swr')
.description('set the workers roles')
.action(id => addWorkerRoleUsingTerminal(id));
program
.command('create-schedule <month>')
.alias('cs')
.description('create a new schedule for the given month')
.action(month => newScheduleUsingTerminal(month));
program
.command('add-worker-timeoff <workerid>')
.alias('awt')
.description('set the workers time off')
.action((id) => {
addTimeOffUsingTerminal(id);
});
// // Assert that a VALID command is provided
// if (!process.argv.slice(2).length || !/[arudl]/.test(process.argv.slice(2))) {
// program.outputHelp();
// process.exit();
// }
program.parse(process.argv);