-
Notifications
You must be signed in to change notification settings - Fork 131
/
cli-program.ts
69 lines (60 loc) · 1.98 KB
/
cli-program.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
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
import { Command } from 'commander';
import {
CreateChangeSetCommand,
DeleteStacksCommand,
DescribeStacksCommand,
ExecuteChangeSetCommand,
InitOrganizationCommand,
InitPipelineCommand,
PerformTasksCommand,
PrintChangeSetCommand,
PrintOrganizationCommand,
PrintStacksCommand,
UpdateOrganizationCommand,
UpdateStacksCommand,
ValidateStacksCommand,
ValidateTasksCommand,
RemoveCommand,
} from '~commands/index';
import { PrintTasksCommand } from '~commands/print-tasks';
export class CliProgram {
public static Create(): Command {
const p = new CliProgram();
return p.getCommand();
}
private static GetVersion(): string {
let pjson;
try {
pjson = require('../package.json');
} catch (err) {
pjson = require('./package.json');
}
return pjson.version;
}
public commandNames: string[];
private readonly program: Command;
constructor() {
this.program = new Command();
this.program.version(CliProgram.GetVersion(), '-v, --version');
this.program.description('aws organization formation');
new CreateChangeSetCommand(this.program);
new DeleteStacksCommand(this.program);
new DescribeStacksCommand(this.program);
new ExecuteChangeSetCommand(this.program);
new InitPipelineCommand(this.program);
new InitOrganizationCommand(this.program);
new PerformTasksCommand(this.program);
new PrintChangeSetCommand(this.program);
new PrintOrganizationCommand(this.program);
new PrintTasksCommand(this.program);
new PrintStacksCommand(this.program);
new UpdateOrganizationCommand(this.program);
new UpdateStacksCommand(this.program);
new ValidateStacksCommand(this.program);
new ValidateTasksCommand(this.program);
new RemoveCommand(this.program);
}
public getCommand(): Command {
return this.program;
}
}