-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdict.js
More file actions
69 lines (54 loc) · 1.93 KB
/
Copy pathdict.js
File metadata and controls
69 lines (54 loc) · 1.93 KB
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
var program = require('commander');
var interface = require('./interface');
var interface_wod = require('./interface_wod');
var interface_play = require('./interface_play');
program
.usage('[Options]')
.option('', 'Display definitions, synonyms, \n\t\t\t\t antonyms & examples of word of the day\n')
.option('def <word>', 'Display definitions of a word.\n')
.option('syn <word>', 'Display synonyms of a word.\n')
.option('ant <word>', 'Display antonyms of a word.\n')
.option('ex <word>', 'Display examples of a word.\n')
.option('dict <word> or <word>', 'Display definitions, synonyms, \n\t\t\t\t antonyms & examples of word\n')
.option('play', 'Display a definition, synonym, or antonym; \n\t\t\t\t user enters the answer and game begins\n')
.parse(process.argv);
// convert words to lower case before sending them to core
if(program.rawArgs.length==2) {
// word of the day
interface_wod.getWordofTheDay();
} else if(program.play) {
//playgame
interface_play.PlayGame();
} else if (program.rawArgs.length ==3) {
var word = program.args[0].toLowerCase();
console.log(word);
interface.getDefinition(word);
interface.getSynonyms(word);
interface.getAntonyms(word);
interface.getExamples(word);
} else if(program.def){
var word = program.def.toLowerCase();
console.log(word)
interface.getDefinition(word);
} else if(program.syn) {
var word = program.syn.toLowerCase();
console.log(word)
interface.getSynonyms(word);
} else if(program.dict){
var word = program.dict.toLowerCase();
console.log(word)
interface.getDefinition(word);
interface.getSynonyms(word);
interface.getAntonyms(word);
interface.getExamples(word);
} else if(program.ant){
var word = program.ant.toLowerCase();
console.log(word)
interface.getAntonyms(word);
} else if(program.ex){
var word = program.ex.toLowerCase();
console.log(word)
interface.getExamples(word);
} else {
console.log("please enter a valid option, check help. --help or -h ");
}