-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
39 lines (33 loc) · 1 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
const program = require('commander');
const GitToFolder = require('./app/git-to-folder');
const Prompt = require('./app/prompt');
const pkg = require('./package.json');
class App{
static main(args){
let execAction;
// commander config
program
.version(pkg.version)
.arguments('<extract|update>')
.action((action)=>{
execAction = action;
})
.parse(args);
if(execAction ==='extract' || execAction =='update' ){
let prompt = new Prompt();
prompt.exec().then(options =>{
let gtf = new GitToFolder(options);
if(execAction === 'extract'){
gtf.branchToFolder()
}else{
gtf.folderToBranch();
}
return Promise.resolve();
})
.catch(console.error);
}else{
console.log('usage : git2folder <extract|update>');
}
}
}
App.main(process.argv);