cli-kiss 0.2.8 → 0.2.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +8 -3
- package/dist/index.d.ts +89 -69
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/docs/guide/01_getting_started.md +2 -2
- package/docs/guide/02_commands.md +2 -2
- package/docs/guide/04_positionals.md +9 -9
- package/docs/guide/05_input_types.md +8 -6
- package/package.json +1 -1
- package/src/lib/Command.ts +8 -3
- package/src/lib/Operation.ts +13 -5
- package/src/lib/Option.ts +22 -20
- package/src/lib/Positional.ts +17 -12
- package/src/lib/Reader.ts +14 -20
- package/src/lib/Run.ts +2 -2
- package/src/lib/Type.ts +145 -120
- package/src/lib/Typo.ts +1 -1
- package/tests/unit.Reader.commons.ts +29 -42
- package/tests/unit.Reader.parsings.ts +3 -3
- package/tests/unit.Reader.shortBig.ts +29 -40
- package/tests/unit.command.aliases.ts +10 -22
- package/tests/unit.command.execute.ts +5 -5
- package/tests/unit.command.usage.ts +8 -8
- package/tests/unit.runner.cycle.ts +31 -18
|
@@ -1,9 +1,5 @@
|
|
|
1
1
|
import { expect, it } from "@jest/globals";
|
|
2
|
-
import {
|
|
3
|
-
ReaderArgs,
|
|
4
|
-
ReaderOptionNextGuard,
|
|
5
|
-
ReaderOptionRestGuard,
|
|
6
|
-
} from "../src";
|
|
2
|
+
import { ReaderArgs, ReaderOptionNextGuard } from "../src";
|
|
7
3
|
|
|
8
4
|
it("run", async function () {
|
|
9
5
|
const stream = new ReaderArgs([
|
|
@@ -25,115 +21,108 @@ it("run", async function () {
|
|
|
25
21
|
|
|
26
22
|
const kSofUnset = stream.registerOptionShort({
|
|
27
23
|
key: "sof-unset",
|
|
28
|
-
restGuard: optionFlagRestGuard,
|
|
29
24
|
nextGuard: optionFlagNextGuard,
|
|
25
|
+
consumeGroupRestAsValue: false,
|
|
30
26
|
});
|
|
31
27
|
const kSofNormal = stream.registerOptionShort({
|
|
32
28
|
key: "sof-normal",
|
|
33
|
-
restGuard: optionFlagRestGuard,
|
|
34
29
|
nextGuard: optionFlagNextGuard,
|
|
30
|
+
consumeGroupRestAsValue: false,
|
|
35
31
|
});
|
|
36
32
|
const kSofPositive = stream.registerOptionShort({
|
|
37
33
|
key: "sof-positive",
|
|
38
|
-
restGuard: optionFlagRestGuard,
|
|
39
34
|
nextGuard: optionFlagNextGuard,
|
|
35
|
+
consumeGroupRestAsValue: false,
|
|
40
36
|
});
|
|
41
37
|
const kSofNegative = stream.registerOptionShort({
|
|
42
38
|
key: "sof-negative",
|
|
43
|
-
restGuard: optionFlagRestGuard,
|
|
44
39
|
nextGuard: optionFlagNextGuard,
|
|
40
|
+
consumeGroupRestAsValue: false,
|
|
45
41
|
});
|
|
46
42
|
|
|
47
43
|
const kAa = stream.registerOptionShort({
|
|
48
44
|
key: "aa",
|
|
49
|
-
restGuard: optionFlagRestGuard,
|
|
50
45
|
nextGuard: optionFlagNextGuard,
|
|
46
|
+
consumeGroupRestAsValue: false,
|
|
51
47
|
});
|
|
52
48
|
const kBb = stream.registerOptionShort({
|
|
53
49
|
key: "bb",
|
|
54
|
-
restGuard: optionFlagRestGuard,
|
|
55
50
|
nextGuard: optionFlagNextGuard,
|
|
51
|
+
consumeGroupRestAsValue: false,
|
|
56
52
|
});
|
|
57
53
|
const kCc = stream.registerOptionShort({
|
|
58
54
|
key: "cc",
|
|
59
|
-
restGuard: optionFlagRestGuard,
|
|
60
55
|
nextGuard: optionFlagNextGuard,
|
|
56
|
+
consumeGroupRestAsValue: false,
|
|
61
57
|
});
|
|
62
58
|
|
|
63
59
|
expect(stream.consumePositional()).toStrictEqual("positional-1");
|
|
64
60
|
|
|
65
61
|
const kSovSplit = stream.registerOptionShort({
|
|
66
62
|
key: "sov-split",
|
|
67
|
-
restGuard: optionValuedRestGuard,
|
|
68
63
|
nextGuard: optionValuedNextGuard,
|
|
64
|
+
consumeGroupRestAsValue: true,
|
|
69
65
|
});
|
|
70
66
|
const kSovJoin = stream.registerOptionShort({
|
|
71
67
|
key: "sov-join",
|
|
72
|
-
restGuard: optionValuedRestGuard,
|
|
73
68
|
nextGuard: optionValuedNextGuard,
|
|
69
|
+
consumeGroupRestAsValue: true,
|
|
74
70
|
});
|
|
75
71
|
const kSovUnset = stream.registerOptionShort({
|
|
76
72
|
key: "sov-unset",
|
|
77
|
-
restGuard: optionValuedRestGuard,
|
|
78
73
|
nextGuard: optionValuedNextGuard,
|
|
74
|
+
consumeGroupRestAsValue: true,
|
|
79
75
|
});
|
|
80
76
|
|
|
81
77
|
const kDd = stream.registerOptionShort({
|
|
82
78
|
key: "dd",
|
|
83
|
-
restGuard: optionFlagRestGuard,
|
|
84
79
|
nextGuard: optionFlagNextGuard,
|
|
80
|
+
consumeGroupRestAsValue: false,
|
|
85
81
|
});
|
|
86
82
|
const kEe = stream.registerOptionShort({
|
|
87
83
|
key: "ee",
|
|
88
|
-
restGuard: optionFlagRestGuard,
|
|
89
84
|
nextGuard: optionFlagNextGuard,
|
|
85
|
+
consumeGroupRestAsValue: false,
|
|
90
86
|
});
|
|
91
87
|
|
|
92
88
|
const kFf = stream.registerOptionShort({
|
|
93
89
|
key: "ff",
|
|
94
|
-
restGuard: optionFlagRestGuard,
|
|
95
90
|
nextGuard: optionFlagNextGuard,
|
|
91
|
+
consumeGroupRestAsValue: false,
|
|
96
92
|
});
|
|
97
93
|
const kGg = stream.registerOptionShort({
|
|
98
94
|
key: "gg",
|
|
99
|
-
restGuard: optionFlagRestGuard,
|
|
100
95
|
nextGuard: optionFlagNextGuard,
|
|
96
|
+
consumeGroupRestAsValue: false,
|
|
101
97
|
});
|
|
102
98
|
|
|
103
99
|
expect(stream.consumePositional()).toStrictEqual("positional-2");
|
|
104
100
|
|
|
105
|
-
expect(kSofUnset()
|
|
106
|
-
expect(kSofNormal()
|
|
107
|
-
expect(kSofPositive()
|
|
108
|
-
|
|
109
|
-
]);
|
|
110
|
-
expect(kSofNegative().values).toStrictEqual([
|
|
111
|
-
{ inlined: "false", separated: [] },
|
|
112
|
-
]);
|
|
101
|
+
expect(kSofUnset()).toStrictEqual([]);
|
|
102
|
+
expect(kSofNormal()).toStrictEqual([{ inlined: null, separated: [] }]);
|
|
103
|
+
expect(kSofPositive()).toStrictEqual([{ inlined: "true", separated: [] }]);
|
|
104
|
+
expect(kSofNegative()).toStrictEqual([{ inlined: "false", separated: [] }]);
|
|
113
105
|
|
|
114
|
-
expect(kAa()
|
|
115
|
-
expect(kBb()
|
|
116
|
-
expect(kCc()
|
|
106
|
+
expect(kAa()).toStrictEqual([{ inlined: null, separated: [] }]);
|
|
107
|
+
expect(kBb()).toStrictEqual([{ inlined: null, separated: [] }]);
|
|
108
|
+
expect(kCc()).toStrictEqual([{ inlined: null, separated: [] }]);
|
|
117
109
|
|
|
118
|
-
expect(kSovUnset()
|
|
119
|
-
expect(kSovSplit()
|
|
110
|
+
expect(kSovUnset()).toStrictEqual([]);
|
|
111
|
+
expect(kSovSplit()).toStrictEqual([
|
|
120
112
|
{ inlined: null, separated: ["1.1"] },
|
|
121
113
|
{ inlined: null, separated: ["1.2"] },
|
|
122
114
|
]);
|
|
123
|
-
expect(kSovJoin()
|
|
115
|
+
expect(kSovJoin()).toStrictEqual([
|
|
124
116
|
{ inlined: "2.1", separated: [] },
|
|
125
117
|
{ inlined: "2.2", separated: [] },
|
|
126
118
|
]);
|
|
127
119
|
|
|
128
|
-
expect(kDd()
|
|
129
|
-
expect(kEe()
|
|
130
|
-
expect(kFf()
|
|
131
|
-
expect(kGg()
|
|
120
|
+
expect(kDd()).toStrictEqual([{ inlined: null, separated: [] }]);
|
|
121
|
+
expect(kEe()).toStrictEqual([{ inlined: null, separated: [] }]);
|
|
122
|
+
expect(kFf()).toStrictEqual([{ inlined: null, separated: [] }]);
|
|
123
|
+
expect(kGg()).toStrictEqual([{ inlined: null, separated: [] }]);
|
|
132
124
|
});
|
|
133
125
|
|
|
134
|
-
const optionFlagRestGuard: ReaderOptionRestGuard = () => false;
|
|
135
126
|
const optionFlagNextGuard: ReaderOptionNextGuard = () => false;
|
|
136
|
-
|
|
137
|
-
const optionValuedRestGuard: ReaderOptionRestGuard = () => true;
|
|
138
127
|
const optionValuedNextGuard: ReaderOptionNextGuard = (value) =>
|
|
139
128
|
value.inlined === null && value.separated.length === 0;
|
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
optionRepeatable,
|
|
7
7
|
optionSingleValue,
|
|
8
8
|
ReaderArgs,
|
|
9
|
-
|
|
9
|
+
typeString,
|
|
10
10
|
} from "../src";
|
|
11
11
|
|
|
12
12
|
it("run", async function () {
|
|
@@ -17,7 +17,7 @@ it("run", async function () {
|
|
|
17
17
|
options: {
|
|
18
18
|
option: optionRepeatable({
|
|
19
19
|
long: "option",
|
|
20
|
-
type:
|
|
20
|
+
type: typeString(),
|
|
21
21
|
aliases: {
|
|
22
22
|
longs: ["option-alias1", "option-alias2"],
|
|
23
23
|
shorts: ["pts", "o"],
|
|
@@ -25,40 +25,28 @@ it("run", async function () {
|
|
|
25
25
|
}),
|
|
26
26
|
flag1: optionFlag({
|
|
27
27
|
long: "flag1",
|
|
28
|
-
aliases: {
|
|
29
|
-
longs: ["flag1-alias"],
|
|
30
|
-
shorts: ["fa"],
|
|
31
|
-
},
|
|
28
|
+
aliases: { longs: ["flag1-alias"], shorts: ["fa"] },
|
|
32
29
|
}),
|
|
33
30
|
flag2: optionFlag({
|
|
34
31
|
long: "flag2",
|
|
35
|
-
aliases: {
|
|
36
|
-
longs: ["flag2-alias"],
|
|
37
|
-
shorts: ["fb"],
|
|
38
|
-
},
|
|
32
|
+
aliases: { longs: ["flag2-alias"], shorts: ["fb"] },
|
|
39
33
|
}),
|
|
40
34
|
weird: optionRepeatable({
|
|
41
35
|
long: "2",
|
|
42
|
-
aliases: {
|
|
43
|
-
|
|
44
|
-
},
|
|
45
|
-
type: type(),
|
|
36
|
+
aliases: { shorts: ["2o"] },
|
|
37
|
+
type: typeString(),
|
|
46
38
|
}),
|
|
47
39
|
v1: optionSingleValue({
|
|
48
40
|
long: "v1",
|
|
49
|
-
aliases: {
|
|
50
|
-
|
|
51
|
-
},
|
|
52
|
-
type: type(),
|
|
41
|
+
aliases: { shorts: ["va"] },
|
|
42
|
+
type: typeString(),
|
|
53
43
|
impliedValueIfNotInlined: () => "bypass",
|
|
54
44
|
fallbackValueIfAbsent: () => undefined,
|
|
55
45
|
}),
|
|
56
46
|
v2: optionSingleValue({
|
|
57
47
|
long: "v2",
|
|
58
|
-
aliases: {
|
|
59
|
-
|
|
60
|
-
},
|
|
61
|
-
type: type(),
|
|
48
|
+
aliases: { shorts: ["vb"] },
|
|
49
|
+
type: typeString(),
|
|
62
50
|
impliedValueIfNotInlined: () => "bypass",
|
|
63
51
|
fallbackValueIfAbsent: () => undefined,
|
|
64
52
|
}),
|
|
@@ -12,9 +12,9 @@ import {
|
|
|
12
12
|
positionalRequired,
|
|
13
13
|
positionalVariadics,
|
|
14
14
|
ReaderArgs,
|
|
15
|
-
type,
|
|
16
15
|
typeList,
|
|
17
16
|
typeNumber,
|
|
17
|
+
typeString,
|
|
18
18
|
} from "../src";
|
|
19
19
|
|
|
20
20
|
const rootCommand = commandChained(
|
|
@@ -46,7 +46,7 @@ const rootCommand = commandChained(
|
|
|
46
46
|
options: {
|
|
47
47
|
string: optionSingleValue({
|
|
48
48
|
long: "string-option",
|
|
49
|
-
type:
|
|
49
|
+
type: typeString(),
|
|
50
50
|
fallbackValueIfAbsent: () => undefined,
|
|
51
51
|
}),
|
|
52
52
|
number: optionRepeatable({
|
|
@@ -66,7 +66,7 @@ const rootCommand = commandChained(
|
|
|
66
66
|
operation(
|
|
67
67
|
{
|
|
68
68
|
options: {},
|
|
69
|
-
positionals: [positionalRequired({ type:
|
|
69
|
+
positionals: [positionalRequired({ type: typeString() })],
|
|
70
70
|
},
|
|
71
71
|
async function (context, inputs) {
|
|
72
72
|
return { at: "sub1", context, inputs };
|
|
@@ -80,8 +80,8 @@ const rootCommand = commandChained(
|
|
|
80
80
|
options: {},
|
|
81
81
|
positionals: [
|
|
82
82
|
positionalRequired({ type: typeNumber() }),
|
|
83
|
-
positionalOptional({ type:
|
|
84
|
-
positionalVariadics({ type:
|
|
83
|
+
positionalOptional({ type: typeString(), default: () => "42" }),
|
|
84
|
+
positionalVariadics({ type: typeString() }),
|
|
85
85
|
],
|
|
86
86
|
},
|
|
87
87
|
async function (context, inputs) {
|
|
@@ -12,10 +12,10 @@ import {
|
|
|
12
12
|
positionalRequired,
|
|
13
13
|
positionalVariadics,
|
|
14
14
|
ReaderArgs,
|
|
15
|
-
type,
|
|
16
15
|
typeChoice,
|
|
17
16
|
typeList,
|
|
18
17
|
typeNumber,
|
|
18
|
+
typeString,
|
|
19
19
|
typeTuple,
|
|
20
20
|
TypoSupport,
|
|
21
21
|
usageToStyledLines,
|
|
@@ -79,13 +79,13 @@ const rootCommand = commandChained<any, any, any>(
|
|
|
79
79
|
stringOption: optionSingleValue({
|
|
80
80
|
short: "s",
|
|
81
81
|
long: "string-option",
|
|
82
|
-
type:
|
|
82
|
+
type: typeString("cool-stuff"),
|
|
83
83
|
fallbackValueIfAbsent: () => undefined,
|
|
84
84
|
description: "string-option description",
|
|
85
85
|
}),
|
|
86
86
|
complexOption: optionRepeatable({
|
|
87
87
|
long: "complex-option",
|
|
88
|
-
type: typeTuple([typeNumber(), typeList(
|
|
88
|
+
type: typeTuple([typeNumber(), typeList(typeString("string"))]),
|
|
89
89
|
description: "complex-option description",
|
|
90
90
|
}),
|
|
91
91
|
},
|
|
@@ -127,7 +127,7 @@ const rootCommand = commandChained<any, any, any>(
|
|
|
127
127
|
positionals: [
|
|
128
128
|
positionalRequired({
|
|
129
129
|
description: "Required positional string",
|
|
130
|
-
type:
|
|
130
|
+
type: typeString("pos-3.1"),
|
|
131
131
|
}),
|
|
132
132
|
],
|
|
133
133
|
},
|
|
@@ -172,14 +172,14 @@ const rootCommand = commandChained<any, any, any>(
|
|
|
172
172
|
options: {
|
|
173
173
|
duduValue: optionSingleValue({
|
|
174
174
|
long: "dudu",
|
|
175
|
-
type:
|
|
175
|
+
type: typeString("dudu-value"),
|
|
176
176
|
fallbackValueIfAbsent: () => "duduDefault",
|
|
177
177
|
hint: "Dudu option hint",
|
|
178
178
|
description: "Dudu option description",
|
|
179
179
|
}),
|
|
180
180
|
impliable: optionSingleValue({
|
|
181
181
|
long: "impliable",
|
|
182
|
-
type:
|
|
182
|
+
type: typeString("text"),
|
|
183
183
|
impliedValueIfNotInlined: () => "implied",
|
|
184
184
|
fallbackValueIfAbsent: () => "absent",
|
|
185
185
|
}),
|
|
@@ -192,12 +192,12 @@ const rootCommand = commandChained<any, any, any>(
|
|
|
192
192
|
positionalOptional({
|
|
193
193
|
description: "Optional positional string",
|
|
194
194
|
hint: "Optional positional hint",
|
|
195
|
-
type:
|
|
195
|
+
type: typeString("pos-4"),
|
|
196
196
|
default: () => "42",
|
|
197
197
|
}),
|
|
198
198
|
positionalVariadics({
|
|
199
199
|
description: "Variadic positionals strings",
|
|
200
|
-
type:
|
|
200
|
+
type: typeString("pos-5"),
|
|
201
201
|
}),
|
|
202
202
|
],
|
|
203
203
|
},
|
|
@@ -10,9 +10,9 @@ import {
|
|
|
10
10
|
positionalRequired,
|
|
11
11
|
positionalVariadics,
|
|
12
12
|
runAndExit,
|
|
13
|
-
type,
|
|
14
13
|
typeChoice,
|
|
15
|
-
|
|
14
|
+
typeMapped,
|
|
15
|
+
typeString,
|
|
16
16
|
typeUrl,
|
|
17
17
|
} from "../src";
|
|
18
18
|
|
|
@@ -20,13 +20,15 @@ it("run", async function () {
|
|
|
20
20
|
const rootUsage = [
|
|
21
21
|
"Usage: my-cli <req1> <subcommand>",
|
|
22
22
|
"",
|
|
23
|
-
"Root Description",
|
|
23
|
+
"Root Description (Hint for root)",
|
|
24
|
+
"Root details1",
|
|
25
|
+
"Root details2",
|
|
24
26
|
"",
|
|
25
27
|
"Positionals:",
|
|
26
|
-
" <req1> Required1 positional description",
|
|
28
|
+
" <req1> Required1 positional description (Hint for req1)",
|
|
27
29
|
"",
|
|
28
30
|
"Subcommands:",
|
|
29
|
-
" sub Subcommand Description",
|
|
31
|
+
" sub Subcommand Description (Hint for sub)",
|
|
30
32
|
"",
|
|
31
33
|
"Options:",
|
|
32
34
|
" -ff, --flag[=no] Option flag description",
|
|
@@ -37,10 +39,12 @@ it("run", async function () {
|
|
|
37
39
|
const subUsage = [
|
|
38
40
|
"Usage: my-cli <req1> sub <req2> [optional] [variadic]...",
|
|
39
41
|
"",
|
|
40
|
-
"Subcommand Description",
|
|
42
|
+
"Subcommand Description (Hint for sub)",
|
|
43
|
+
"Sub details1",
|
|
44
|
+
"Sub details2",
|
|
41
45
|
"",
|
|
42
46
|
"Positionals:",
|
|
43
|
-
" <req1> Required1 positional description",
|
|
47
|
+
" <req1> Required1 positional description (Hint for req1)",
|
|
44
48
|
" <req2> Required2 positional description",
|
|
45
49
|
" [optional] Optional positional description",
|
|
46
50
|
" [variadic]... Variadics positional description",
|
|
@@ -123,14 +127,14 @@ it("run", async function () {
|
|
|
123
127
|
[],
|
|
124
128
|
[
|
|
125
129
|
rootUsage,
|
|
126
|
-
"Error: <req1>:
|
|
130
|
+
"Error: Missing argument: <req1>: Required1 positional description (Hint for req1)",
|
|
127
131
|
],
|
|
128
132
|
1,
|
|
129
133
|
);
|
|
130
134
|
await testCase(
|
|
131
135
|
["req1"],
|
|
132
136
|
[],
|
|
133
|
-
[rootUsage, "Error:
|
|
137
|
+
[rootUsage, "Error: Missing argument: <subcommand>. Did you mean: sub ?"],
|
|
134
138
|
1,
|
|
135
139
|
);
|
|
136
140
|
await testCase(
|
|
@@ -138,7 +142,7 @@ it("run", async function () {
|
|
|
138
142
|
[],
|
|
139
143
|
[
|
|
140
144
|
subUsage,
|
|
141
|
-
"Error: <req2>:
|
|
145
|
+
"Error: Missing argument: <req2>: Required2 positional description",
|
|
142
146
|
],
|
|
143
147
|
1,
|
|
144
148
|
);
|
|
@@ -167,7 +171,7 @@ it("run", async function () {
|
|
|
167
171
|
[],
|
|
168
172
|
[
|
|
169
173
|
subUsage,
|
|
170
|
-
"Error: <req2>:
|
|
174
|
+
"Error: Missing argument: <req2>: Required2 positional description",
|
|
171
175
|
],
|
|
172
176
|
1,
|
|
173
177
|
);
|
|
@@ -252,7 +256,7 @@ it("run", async function () {
|
|
|
252
256
|
await testCase(
|
|
253
257
|
["invalid"],
|
|
254
258
|
[],
|
|
255
|
-
[rootUsage, "Error:
|
|
259
|
+
[rootUsage, "Error: Missing argument: <subcommand>. Did you mean: sub ?"],
|
|
256
260
|
1,
|
|
257
261
|
);
|
|
258
262
|
await testCase(
|
|
@@ -407,7 +411,11 @@ async function testCase(
|
|
|
407
411
|
]);
|
|
408
412
|
const onExit = makeMocked<number, never>([null as never]);
|
|
409
413
|
const cmd = commandWithSubcommands<null, void, void>(
|
|
410
|
-
{
|
|
414
|
+
{
|
|
415
|
+
description: "Root Description",
|
|
416
|
+
hint: "Hint for root",
|
|
417
|
+
details: ["Root details1", "Root details2"],
|
|
418
|
+
},
|
|
411
419
|
operation(
|
|
412
420
|
{
|
|
413
421
|
options: {
|
|
@@ -419,13 +427,13 @@ async function testCase(
|
|
|
419
427
|
optionRepeatable: optionRepeatable({
|
|
420
428
|
long: "repeatable",
|
|
421
429
|
short: "r",
|
|
422
|
-
type:
|
|
430
|
+
type: typeString(),
|
|
423
431
|
description: "Option repeatable description",
|
|
424
432
|
}),
|
|
425
433
|
optionSingleValue: optionSingleValue({
|
|
426
434
|
long: "single-value",
|
|
427
435
|
short: "s",
|
|
428
|
-
type:
|
|
436
|
+
type: typeMapped(
|
|
429
437
|
"enum(number)",
|
|
430
438
|
typeChoice("enum(string)", ["42", "43"]),
|
|
431
439
|
(value) => Number(value),
|
|
@@ -438,6 +446,7 @@ async function testCase(
|
|
|
438
446
|
positionalRequired({
|
|
439
447
|
type: typeChoice("req1", ["req1", "req1-bis"]),
|
|
440
448
|
description: "Required1 positional description",
|
|
449
|
+
hint: "Hint for req1",
|
|
441
450
|
}),
|
|
442
451
|
],
|
|
443
452
|
},
|
|
@@ -447,7 +456,11 @@ async function testCase(
|
|
|
447
456
|
),
|
|
448
457
|
{
|
|
449
458
|
sub: command(
|
|
450
|
-
{
|
|
459
|
+
{
|
|
460
|
+
description: "Subcommand Description",
|
|
461
|
+
hint: "Hint for sub",
|
|
462
|
+
details: ["Sub details1", "Sub details2"],
|
|
463
|
+
},
|
|
451
464
|
operation(
|
|
452
465
|
{
|
|
453
466
|
options: {
|
|
@@ -464,12 +477,12 @@ async function testCase(
|
|
|
464
477
|
description: "Required2 positional description",
|
|
465
478
|
}),
|
|
466
479
|
positionalOptional({
|
|
467
|
-
type:
|
|
480
|
+
type: typeString("optional"),
|
|
468
481
|
description: "Optional positional description",
|
|
469
482
|
default: () => "world !",
|
|
470
483
|
}),
|
|
471
484
|
positionalVariadics({
|
|
472
|
-
type:
|
|
485
|
+
type: typeString("variadic"),
|
|
473
486
|
description: "Variadics positional description",
|
|
474
487
|
}),
|
|
475
488
|
],
|