-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathCommon.ts
63 lines (50 loc) · 1.23 KB
/
Common.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
#!/usr/bin/env node
import { MustardFactory } from "mustard-cli";
import {
Command,
RootCommand,
Option,
VariadicOption,
App,
Input,
Options,
} from "mustard-cli/decorator";
import { Validator } from "mustard-cli/validator";
import { CommandStruct, MustardApp } from "mustard-cli/cli";
import path from "path";
@RootCommand()
class RootCommandHandle implements CommandStruct {
@Option("m")
public msg = "default value of msg";
public run(): void {
console.log("Root Command! ", this.msg);
}
}
@Command("update", "u", "update project dependencies")
class UpdateCommand implements CommandStruct {
@Option("depth", Validator.Number().Gte(1))
public depth = 10;
@Option(Validator.Boolean())
public dry = false;
@Options()
public completeOptions: unknown;
@Input()
public input: string[];
@VariadicOption()
public packages: string[] = [];
public run(): void {}
}
@App({
name: "LinbuduLab CLI",
commands: [RootCommandHandle, UpdateCommand],
configurations: {
allowUnknownOptions: true,
enableVersion: require(path.resolve("./package.json")).version,
},
providers: [],
})
class Project implements MustardApp {
onStart() {}
onComplete() {}
}
MustardFactory.init(Project).start();