-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
executable file
·64 lines (53 loc) · 1.23 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
#!/usr/bin/env node
// load environment variables
require('dotenv').config();
const com = require('commander');
const { defAction, synAction, antAction, exAction, allAction, wordOfDayAction, playAction } = require('./actions');
let runWordOfDay = true;
com.version('1.0.0');
com
.command('def <word>')
.description('Definitions of the word')
.action(async (word) => {
defAction(word);
runWordOfDay = false;
});
com
.command('syn <word>')
.description('Synonyms of the word')
.action(async (word) => {
synAction(word);
runWordOfDay = false;
});
com
.command('ant <word>')
.description('Antonyms of the word')
.action(async (word) => {
antAction(word);
runWordOfDay = false;
});
com
.command('ex <word>')
.description('Examples of the word')
.action(async (word) => {
exAction(word);
runWordOfDay = false;
});
com
.command('dict <word>')
.description('All information about the word')
.action(async (word) => {
allAction(word);
runWordOfDay = false;
});
com
.command('play')
.description('A dictionary game - Game-A-Dict')
.action(async () => {
playAction();
runWordOfDay = false;
});
com.parse(process.argv);
if (runWordOfDay) {
wordOfDayAction();
}