-
Notifications
You must be signed in to change notification settings - Fork 37
/
Copy pathcli.js
executable file
·43 lines (39 loc) · 1.15 KB
/
cli.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
#!/usr/bin/env node
const meow = require('meow');
const updateNotifier = require('update-notifier');
const LifeCli = require('./src/lifeCli.js');
const pkg = require('./package.json');
const utils = require('./src/utils.js');
updateNotifier({ pkg }).notify();
const cli = meow(
`
Usage
$ life
Options
--init, -i Initialize your life
--commit, -c Commit on your life
--log, -l Log the commits on your life
--edit , -e <commitId> Edit the existing commits
--dir, -d [folder name] Create a directory that visualizing the commits on webpage
Examples
$ life --commit
`,
{
flags: {
init: { type: 'boolean', alias: 'i' },
commit: { type: 'boolean', alias: 'c' },
log: { type: 'boolean', alias: 'l' },
edit: { type: 'boolean', alias: 'e' },
dir: { type: 'boolean', alias: 'd' },
},
}
);
const lifeCli = new LifeCli(utils.lifeApiClient);
const options = {
init: () => lifeCli.init(),
commit: () => lifeCli.commit(),
log: () => lifeCli.log(),
edit: () => lifeCli.edit(),
dir: () => lifeCli.dir(),
};
utils.findLifeCommand(cli, options);