-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathej-cli.ts
39 lines (37 loc) · 1.1 KB
/
ej-cli.ts
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
import {ShellExec} from './shell-exec';
import {ArgumentParser} from './argument-parser';
import {TemplateRenderer} from './template-renderer';
import {Args} from './application';
export /**
* EjCli
*/
class EjCli {
opts:Args;
shell: ShellExec;
template: TemplateRenderer;
args: ArgumentParser;
constructor(parameters) {
this.args = new ArgumentParser(process.argv)
this.opts = this.args.option;
this.template = new TemplateRenderer(this.args);
this.shell = new ShellExec(this.template);
}
performAction(){
if(this.opts.version != null){
console.log(this.opts.version);
return;
}
if(this.opts.createEmpty){
this.shell.checkEJLocation(this.opts.projectName, this.opts.ejVersion, this.opts.controList);
return;
}
if(this.opts.controList.length != 0){
console.log(this.opts.controList);
return;
}
if(this.opts.getEjVersion){
console.log(this.opts.ejVersion);
return;
}
}
}