-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
71 lines (62 loc) · 1.86 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
65
66
67
68
69
70
71
#!/usr/bin/env node
const program = require('commander');
const pkg = require('./package.json');
const init = require('./src/commands/init');
const add = require('./src/commands/add');
const commit = require('./src/commands/commit');
const status = require('./src/commands/status');
const rmCache = require('./src/commands/rm-cache');
const log = require('./src/commands/log');
const { prompt, emphasize } = require('./src/utils/notice');
const clone = require('./src/commands/clone');
// handle the command
program
.command('init')
.description('initialize the Jit files')
.action((options) => {
init(options);
});
program
.command('add')
.description('add all the files into storage')
.action((options) => {
add(options);
});
program
.command('commit')
.description('create a commit record')
.option('-m, --msg <string>', 'Add a msg for this commit')
.action((options) => {
commit(options);
});
program
.command('status')
.description('log the status of the storage')
.action((options) => {
status(options);
});
program
.command('rm-cache')
.description('clear the storage')
.action((options) => {
rmCache(options);
});
program
.command('log')
.description('display all the commit logs')
.action((options) => {
log(options);
});
program
.command('clone')
.description('clone program to localhost from the remote')
.argument('<string>', 'the remote repository url')
.option('--mode <string>', 'valid param options: jit(default), git')
.action((str, option) => {
clone(str, option);
});
program
.version(pkg.version)
.description(`${prompt('Jit',
`\nMore features will be supported soon... \nRecent plan is adjust the storage structure to make it more suitable for JavaScript.\nFeedback more ideas or issues: ${emphasize('https://github.com/CoderSerio/jit')}`)}`);
program.parse(process.argv);