-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.js
92 lines (70 loc) · 1.42 KB
/
app.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
const yargs=require('yargs')
const notes=require('./notes.js')
yargs.command({
command:'add',
describe:'add new data',
builder:{
roll:{
describe:'note roll',
demandOption:true,
type:'string'
},
s1:{
describe:'note s1',
demandOption:true,
type:'string'
},
s2:{
describe:'note s2',
demandOption:true,
type:'string'
},
s3:{
describe:'note s3',
demandOption:true,
type:'string'
}
},
handler(argv){
notes.addNotes(argv.roll,argv.s1,argv.s2,argv.s3)
}
})
//create remove command
yargs.command({
command:'remove',
describe:'removing data',
builder:{
roll:{
describe:'note roll',
demandOption:true,
type:'string'
}
},
handler(argv){
notes.removeNotes(argv.roll)
}
})
//create list
yargs.command({
command:'list',
describe:'listing data',
handler(){
notes.listNotes()
}
})
//create read
yargs.command({
command:'read',
describe:'reading data',
builder:{
roll:{
describe:'note roll',
demandOption:true,
type:'string'
}
},
handler(argv){
notes.readNotes(argv.roll)
}
})
yargs.parse()