cli-kiss 0.2.1 → 0.2.2
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 +1 -2
- package/dist/index.d.ts +71 -63
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/docs/guide/01_getting_started.md +5 -5
- package/docs/guide/02_commands.md +1 -1
- package/docs/guide/06_run.md +3 -3
- package/docs/index.md +1 -1
- package/package.json +1 -1
- package/src/lib/Command.ts +27 -27
- package/src/lib/Operation.ts +27 -21
- package/src/lib/Option.ts +19 -25
- package/src/lib/Positional.ts +57 -29
- package/src/lib/Run.ts +3 -3
- package/tests/unit.command.execute.ts +2 -2
- package/tests/unit.command.usage.ts +2 -2
- package/tests/unit.runner.cycle.ts +20 -1
|
@@ -218,7 +218,7 @@ it("run", async () => {
|
|
|
218
218
|
1,
|
|
219
219
|
);
|
|
220
220
|
|
|
221
|
-
// Test invalid
|
|
221
|
+
// Test invalid positional type value
|
|
222
222
|
await testCase(
|
|
223
223
|
["required1", "subcommand", "invalid"],
|
|
224
224
|
[],
|
|
@@ -228,6 +228,17 @@ it("run", async () => {
|
|
|
228
228
|
],
|
|
229
229
|
1,
|
|
230
230
|
);
|
|
231
|
+
|
|
232
|
+
// Test root command option invalid values (must not block parsing)
|
|
233
|
+
await testCase(
|
|
234
|
+
["--single-value=dodo", "required1", "subcommand", "required2"],
|
|
235
|
+
[],
|
|
236
|
+
[
|
|
237
|
+
subcommandUsage,
|
|
238
|
+
'Error: --single-value: <NUMBER-ENUM>: NUMBER-ENUM: from: STRING-ENUM: Invalid value: "dodo" (expected one of: "42" | "43")',
|
|
239
|
+
],
|
|
240
|
+
1,
|
|
241
|
+
);
|
|
231
242
|
await testCase(
|
|
232
243
|
["required1", "subcommand", "required2", "--single-value=44"],
|
|
233
244
|
[],
|
|
@@ -237,6 +248,14 @@ it("run", async () => {
|
|
|
237
248
|
],
|
|
238
249
|
1,
|
|
239
250
|
);
|
|
251
|
+
|
|
252
|
+
// Test subcommand-only option failures
|
|
253
|
+
await testCase(
|
|
254
|
+
["--url", "not-a-url", "required1", "subcommand", "required2"],
|
|
255
|
+
[],
|
|
256
|
+
[rootUsage, "Error: --url: Unexpected unknown option"],
|
|
257
|
+
1,
|
|
258
|
+
);
|
|
240
259
|
await testCase(
|
|
241
260
|
["required1", "subcommand", "required2", "--url", "not-a-url"],
|
|
242
261
|
[],
|