-
Notifications
You must be signed in to change notification settings - Fork 0
/
argument-parser.ts
30 lines (27 loc) · 995 Bytes
/
argument-parser.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
/// <reference path="tds/node.d.ts" />
import {EJ_SWITCHES, EJ_VERSION, Args} from './application';
export /**
* ArgumentParser
*/
class ArgumentParser {
option: Args;
actual: Array<string>;
constructor(parameters: Array<string>) {
this.actual = parameters.slice(2);
this.updateArgs();
}
updateArgs(){
var ix = this.actual.indexOf(EJ_SWITCHES.listcontrols);
var cInx = this.actual.indexOf(EJ_SWITCHES.create);
var evx = this.actual.indexOf(EJ_SWITCHES.ejversion);
var ev = this.actual.indexOf(EJ_SWITCHES.esversion);
this.option = {
version: this.actual.indexOf(EJ_SWITCHES.version) > -1 ? EJ_VERSION : null,
createEmpty: cInx > -1,
projectName: this.actual[cInx + 1],
controList: ix > -1 ? this.actual[ix+1].split(",") : [],
ejVersion: evx > -1 ? this.actual[evx + 1] : "14.1.0.16",
getEjVersion: ev > -1
}
}
}