-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathapp.js
44 lines (34 loc) · 970 Bytes
/
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
const program = require('commander')
const connectWithMongo = require('./config/database')
require('dotenv').config()
connectWithMongo()
const {
listScribbbles,
newScribbble,
findScribbble,
deleteScribbble,
} = require('./scribbblr')
const pkg = require('./package.json')
program.version(pkg.version)
program
.command('list')
.description('Fetch all scribbbles')
.action(listScribbbles)
program
.command('new')
.description('Add a new scribbble')
.option('-t, --title', 'Title of the scribbble')
.option('-c, --content', 'Content of the scribbble')
.option('-d, --date', 'Date of the scribbble')
.action(newScribbble)
program
.command('find')
.description('Find a single scibbble')
.option('-t, --title', 'Title of the scribbble')
.action(findScribbble)
program
.command('delete')
.description('Delete a scribbble')
.option('-t, --title', 'Title of the scribbble')
.action(deleteScribbble)
program.parse(process.argv)