forked from mintuz/BB8-Commander
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
100 lines (84 loc) · 2.84 KB
/
index.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
var program = require('commander'),
packageFile = require('./package.json'),
executeCommand = require('./libs/execute-command');
program.version(packageFile.version);
// Utility Actions
program
.command('setup')
.description('Command to setup BB8 With your Mac')
.action(require('./commands/setup'));
program
.command('disconnect')
.description('Command to disconnect from your BB8 Unit')
.action(function () {
executeCommand('disconnect');
});
// Real Actions
program
.command('disco')
.description('Command to make your BB8 Unit A disco ball')
.action(function () {
executeCommand('disco');
});
program
.command('weather')
.description('Command to get the weather colour from your BB8 Unit')
.option('-c, --city <city>', 'City name such as manchester')
.option('-cc, --country <country>', 'Country name such as uk')
.option('-t, --access-token <accessToken>', 'API Key')
.action(function(options) {
executeCommand('weather', options);
});
program
.command('github')
.description('Command to get notifications of new issues and PRs')
.option('-t, --access-token <accessToken>', 'API Key')
.action(require('github'));
program
.command('roll')
.description('BB8 will roll!')
.action(function () {
executeCommand('roll');
});
program
.command('tweet')
.description('BB8 will respond to tweets!')
.option('-#, --hash-tag <hashTag>', 'Hashtag to search for. Defaults to "#bb8bbc"')
.option('-d, --delay <delay>', 'Interval delay for retrieving new tweets. Defaults to 10000')
.option('--consumer-key <consumerKey>', 'Twitter api consumer key')
.option('--consumer-secret <consumerSecret>', 'Twitter api consumer secret')
.option('--access-token-key <accessTokenKey>', 'Twitter api access token key')
.option('--access-token-secret <accessTokenSecret>', 'Twitter api access token secret')
.action(function (options) {
executeCommand('tweet', options);
});
program
.command('express')
.description('Command to setup express server')
.option('-p, --port <port>', 'Port to run express on. Defaults to 3000')
.action(function (options) {
executeCommand('express', options);
});
program
.command('desk-buddy')
.description('Command to keep you company whilst working at your desk. Place your BB8 in the charging station.')
.action(function (options) {
executeCommand('desk-buddy');
});
program
.command('power')
.description('Command to get the power state of the BB-8')
.action(function (options) {
executeCommand('power');
});
program
.command('drive')
.description('Command to accept keyboard input--use arrow keys')
.action(function (options) {
executeCommand('drive');
});
try {
program.parse(process.argv);
} catch (e) {
console.error(e);
}