-
Notifications
You must be signed in to change notification settings - Fork 1
/
server.js
131 lines (113 loc) · 2.8 KB
/
server.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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
const vorpal = require('vorpal')();
const Actions = require('./inc/actions');
const Server = require('./inc/server');
global.server = new Server();
Actions.init().then(() => {
vorpal.show();
});
vorpal
.command('status')
.description('show module status')
.action(function(args, callback) {
Actions.status(server, true);
callback();
})
vorpal
.command('light <status>')
.description('turn the light on/off')
.action(function(args, callback) {
Actions.light(args.status);
callback();
});
vorpal
.command('reset')
.description('reset module position')
.action(function(args, callback) {
Actions.reset();
callback();
})
vorpal
.command('manual <command> <address> [value]')
.description('send manual commands')
.action(function(args, callback) {
Actions.manual(args.command, args.address, args.value);
callback();
});
vorpal
.command('message [address]')
.description('get current message')
.action(function(args, callback) {
Actions.message(args.address);
callback();
})
vorpal
.command('position [address]')
.description('get module position')
.action(function(args, callback) {
Actions.position(args.address);
callback();
})
vorpal
.command('list <address>')
.description('get module messages')
.action(function(args, callback) {
Actions.list(args.address);
callback();
})
vorpal
.command('find <address> <string>')
.description('move the module <address> to searched <string>')
.action(function(args, callback) {
Actions.find(args.address, args.string)
callback();
})
vorpal
.command('step')
.description('step the module 1 step ahead')
.action(function(args, callback) {
Actions.step()
callback();
})
vorpal
.command('move <address> <position>')
.description('move the module <address> to <position>')
.action(function(args, callback) {
Actions.move(args.address, args.position)
callback();
});
vorpal
.command('time <action>')
.description('display the time')
.action(function(args, callback) {
Actions.time(args.action);
callback();
});
vorpal
.command('date')
.description('display the date')
.action(function(args, callback) {
Actions.date();
callback();
});
vorpal
.command('timetable <action>')
.description('get and display timetable')
.action(function(args, callback) {
Actions.timetable(args.action);
callback();
});
vorpal
.command('schedule <from> <to> [action]')
.description('get live schedule')
.action(function(args, callback) {
Actions.schedule(args.from, args.to, args.action);
callback();
});
vorpal
.command('weather <location>')
.description('get live weather data')
.action(function(args, callback) {
Actions.weather(args.location);
callback();
});
vorpal.delimiter('fallblatt >');