cli-kiss 0.2.5 → 0.2.7

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.
@@ -2,133 +2,132 @@ import { it } from "@jest/globals";
2
2
  import {
3
3
  command,
4
4
  operation,
5
- optionRepeatable,
6
- positionalVariadics,
7
5
  runAndExit,
8
- type,
6
+ RunColorMode,
9
7
  TypoSupport,
10
8
  usageToStyledLines,
11
9
  } from "../src";
12
10
 
13
11
  const cliName = "my-cli";
12
+ const usageBase = {
13
+ segments: [],
14
+ information: { description: "Description" },
15
+ subcommands: [],
16
+ options: [],
17
+ positionals: [],
18
+ };
19
+ const usageNone = usageToStyledLines({
20
+ cliName,
21
+ usage: usageBase,
22
+ typoSupport: TypoSupport.none(),
23
+ }).join("\n");
24
+ const usageMock = usageToStyledLines({
25
+ cliName,
26
+ usage: usageBase,
27
+ typoSupport: TypoSupport.mock(),
28
+ }).join("\n");
29
+ const usageTty = usageToStyledLines({
30
+ cliName,
31
+ usage: usageBase,
32
+ typoSupport: TypoSupport.tty(),
33
+ }).join("\n");
34
+
35
+ const unknownOptionNone =
36
+ 'Error: Unknown option: "--color": did you mean: --help, --version ?';
37
+ const unknownOptionMock =
38
+ '{{Error:}@darkRed}+ Unknown option: {{"--color"}@darkYellow}+: did you mean: {{--help}@darkCyan}+, {{--version}@darkCyan}+ ?';
14
39
 
15
40
  it("run", async function () {
16
- const usage = {
17
- segments: [{ positional: "[string]..." }],
18
- information: { description: "Description" },
19
- subcommands: [],
20
- options: [{ long: "option", label: "<string>", annotation: " [*]" }],
21
- positionals: [{ label: "[string]...", description: "Variadics" }],
22
- };
23
- const usageNone = usageToStyledLines({
24
- cliName,
25
- usage,
26
- typoSupport: TypoSupport.none(),
27
- }).join("\n");
28
- const usageMock = usageToStyledLines({
29
- cliName,
30
- usage,
31
- typoSupport: TypoSupport.mock(),
32
- }).join("\n");
33
- const usageTty = usageToStyledLines({
34
- cliName,
35
- usage,
36
- typoSupport: TypoSupport.tty(),
37
- }).join("\n");
41
+ await withEnv("FORCE_COLOR", "false", async () => {
42
+ if (process.stdout.isTTY) {
43
+ await testAllHelpsSuccesses(usageTty);
44
+ } else {
45
+ await testAllHelpsSuccesses(usageNone);
46
+ }
38
47
 
39
- await testCase("flag", ["--color=auto", "--help"], [usageTty], [], 0);
40
- await testCase("flag", ["--color=always", "--help"], [usageTty], [], 0);
41
- await testCase("flag", ["--color=never", "--help"], [usageNone], [], 0);
42
- await testCase("flag", ["--color=mock", "--help"], [usageMock], [], 0);
43
- await testCase("flag", ["--help"], [usageTty], [], 0);
44
- await testCase("env", ["--help"], [usageTty], [], 0);
45
- await testCase("always", ["--help"], [usageTty], [], 0);
46
- await testCase("never", ["--help"], [usageNone], [], 0);
47
- await testCase("mock", ["--help"], [usageMock], [], 0);
48
+ await withEnv("FORCE_COLOR", "1", async () => {
49
+ await withEnv("NO_COLOR", "1", async () => {
50
+ await testAllHelpsSuccesses(usageNone);
51
+ });
52
+ await withEnv("NO_COLOR", "true", async () => {
53
+ await testAllHelpsSuccesses(usageNone);
54
+ });
55
+ await withEnv("NO_COLOR", "", async () => {
56
+ await testAllHelpsSuccesses(usageTty);
57
+ });
58
+ await withEnv("MOCK_COLOR", "", async () => {
59
+ await testAllHelpsSuccesses(usageTty);
60
+ });
61
+ await withEnv("TERM", "dumb", async () => {
62
+ await testAllHelpsSuccesses(usageTty);
63
+ });
64
+ });
48
65
 
49
- process.env["NO_COLOR"] = "";
50
- await testCase("flag", ["--color=auto", "--help"], [usageNone], [], 0);
51
- await testCase("flag", ["--color=always", "--help"], [usageTty], [], 0);
52
- await testCase("flag", ["--color=never", "--help"], [usageNone], [], 0);
53
- await testCase("flag", ["--color=mock", "--help"], [usageMock], [], 0);
54
- await testCase("flag", ["--help"], [usageNone], [], 0);
55
- await testCase("env", ["--help"], [usageNone], [], 0);
56
- await testCase("always", ["--help"], [usageTty], [], 0);
57
- await testCase("never", ["--help"], [usageNone], [], 0);
58
- await testCase("mock", ["--help"], [usageMock], [], 0);
59
- delete process.env["NO_COLOR"];
66
+ await withEnv("FORCE_COLOR", "2", async () => {
67
+ await testAllHelpsSuccesses(usageTty);
68
+ });
69
+ await withEnv("FORCE_COLOR", "1", async () => {
70
+ await testAllHelpsSuccesses(usageTty);
71
+ });
72
+ await withEnv("FORCE_COLOR", "0", async () => {
73
+ await testAllHelpsSuccesses(usageNone);
74
+ });
75
+ await withEnv("MOCK_COLOR", "true", async () => {
76
+ await testAllHelpsSuccesses(usageMock);
77
+ });
60
78
 
61
- process.env["FORCE_COLOR"] = "";
62
- await testCase("flag", ["--color=auto", "--help"], [usageTty], [], 0);
63
- await testCase("flag", ["--color=always", "--help"], [usageTty], [], 0);
64
- await testCase("flag", ["--color=never", "--help"], [usageNone], [], 0);
65
- await testCase("flag", ["--color=mock", "--help"], [usageMock], [], 0);
66
- await testCase("flag", ["--help"], [usageTty], [], 0);
67
- await testCase("env", ["--help"], [usageTty], [], 0);
68
- await testCase("always", ["--help"], [usageTty], [], 0);
69
- await testCase("never", ["--help"], [usageNone], [], 0);
70
- await testCase("mock", ["--help"], [usageMock], [], 0);
71
- delete process.env["FORCE_COLOR"];
79
+ await withEnv("MOCK_COLOR", "1", async () => {
80
+ await testCase(
81
+ "flag",
82
+ ["--color=42"],
83
+ [],
84
+ [
85
+ usageMock,
86
+ '{{Error:}@darkRed}+ {{--color}@darkCyan}+: {{<color-mode>}@darkBlue}+: Unknown value: {{"42"}@darkYellow}+: did you mean: {{"auto"}@darkYellow}+, {{"always"}@darkYellow}+, {{"never"}@darkYellow}+ ?',
87
+ ],
88
+ 1,
89
+ );
90
+ });
72
91
 
73
- process.env["FORCE_COLOR"] = "0";
74
- await testCase("flag", ["--color=auto", "--help"], [usageNone], [], 0);
75
- await testCase("flag", ["--color=always", "--help"], [usageTty], [], 0);
76
- await testCase("flag", ["--color=never", "--help"], [usageNone], [], 0);
77
- await testCase("flag", ["--color=mock", "--help"], [usageMock], [], 0);
78
- await testCase("flag", ["--help"], [usageNone], [], 0);
79
- await testCase("env", ["--help"], [usageNone], [], 0);
80
- await testCase("always", ["--help"], [usageTty], [], 0);
81
- await testCase("never", ["--help"], [usageNone], [], 0);
82
- await testCase("mock", ["--help"], [usageMock], [], 0);
83
- delete process.env["FORCE_COLOR"];
92
+ await withEnv("MOCK_COLOR", "1", async () => {
93
+ await testAllFlagsFailures("env", usageMock, unknownOptionMock);
94
+ });
95
+ await withEnv("FORCE_COLOR", "0", async () => {
96
+ await testAllFlagsFailures("env", usageNone, unknownOptionNone);
97
+ });
98
+
99
+ await testAllFlagsFailures("mock", usageMock, unknownOptionMock);
100
+ await testAllFlagsFailures("never", usageNone, unknownOptionNone);
101
+ });
102
+ });
103
+
104
+ async function testAllFlagsFailures(
105
+ colorSetup: "flag" | RunColorMode,
106
+ usageErr: string,
107
+ message: string,
108
+ ) {
109
+ await testCase(colorSetup, ["--color=auto"], [], [usageErr, message], 1);
110
+ await testCase(colorSetup, ["--color=always"], [], [usageErr, message], 1);
111
+ await testCase(colorSetup, ["--color=never"], [], [usageErr, message], 1);
112
+ await testCase(colorSetup, ["--color=mock"], [], [usageErr, message], 1);
113
+ await testCase(colorSetup, ["--color"], [], [usageErr, message], 1);
114
+ }
84
115
 
85
- process.env["MOCK_COLOR"] = "";
86
- await testCase("flag", ["--color=auto", "--help"], [usageMock], [], 0);
116
+ async function testAllHelpsSuccesses(usageFromEnv: string) {
117
+ await testCase("flag", ["--color=auto", "--help"], [usageFromEnv], [], 0);
87
118
  await testCase("flag", ["--color=always", "--help"], [usageTty], [], 0);
88
119
  await testCase("flag", ["--color=never", "--help"], [usageNone], [], 0);
89
120
  await testCase("flag", ["--color=mock", "--help"], [usageMock], [], 0);
90
- await testCase("flag", ["--help"], [usageMock], [], 0);
91
- await testCase("env", ["--help"], [usageMock], [], 0);
121
+ await testCase("flag", ["--color", "--help"], [usageTty], [], 0);
122
+ await testCase("flag", ["--help"], [usageFromEnv], [], 0);
123
+ await testCase("env", ["--help"], [usageFromEnv], [], 0);
92
124
  await testCase("always", ["--help"], [usageTty], [], 0);
93
125
  await testCase("never", ["--help"], [usageNone], [], 0);
94
126
  await testCase("mock", ["--help"], [usageMock], [], 0);
95
- delete process.env["MOCK_COLOR"];
96
-
97
- process.env["MOCK_COLOR"] = "";
98
- await testCase(
99
- "flag",
100
- ["--color=42"],
101
- [],
102
- [
103
- usageMock,
104
- '{{Error:}@darkRed}+ {{--color}@darkCyan}+: {{<color-mode>}@darkBlue}+: Invalid value: {{"42"}@darkYellow}+ (expected one of: {{"auto"}@darkYellow}+ | {{"always"}@darkYellow}+ | {{"never"}@darkYellow}+...)',
105
- ],
106
- 1,
107
- );
108
- delete process.env["MOCK_COLOR"];
109
-
110
- const unexpected1 = "Error: Unexpected unknown option: --color";
111
- await testCase("never", ["--color=auto"], [], [usageNone, unexpected1], 1);
112
- await testCase("never", ["--color=always"], [], [usageNone, unexpected1], 1);
113
- await testCase("never", ["--color=never"], [], [usageNone, unexpected1], 1);
114
- await testCase("never", ["--color=mock"], [], [usageNone, unexpected1], 1);
115
- process.env["FORCE_COLOR"] = "0";
116
- await testCase("env", ["--color=auto"], [], [usageNone, unexpected1], 1);
117
- await testCase("env", ["--color=always"], [], [usageNone, unexpected1], 1);
118
- await testCase("env", ["--color=never"], [], [usageNone, unexpected1], 1);
119
- await testCase("env", ["--color=mock"], [], [usageNone, unexpected1], 1);
120
- delete process.env["FORCE_COLOR"];
121
-
122
- const unexpected2 =
123
- "{{Error:}@darkRed}+ Unexpected unknown option: {{--color}@darkYellow}+";
124
- await testCase("mock", ["--color=auto"], [], [usageMock, unexpected2], 1);
125
- await testCase("mock", ["--color=always"], [], [usageMock, unexpected2], 1);
126
- await testCase("mock", ["--color=never"], [], [usageMock, unexpected2], 1);
127
- await testCase("mock", ["--color=mock"], [], [usageMock, unexpected2], 1);
128
- });
127
+ }
129
128
 
130
129
  async function testCase(
131
- colorSetup: "flag" | "env" | "always" | "never" | "mock",
130
+ colorSetup: "flag" | RunColorMode,
132
131
  cliArgs: Array<string>,
133
132
  expectStdOut: Array<string>,
134
133
  expectStdErr: Array<string>,
@@ -145,21 +144,7 @@ async function testCase(
145
144
  const onExit = makeMocked<number, never>([null as never]);
146
145
  const cmd = command<null, void>(
147
146
  { description: "Description" },
148
- operation(
149
- {
150
- options: {
151
- value: optionRepeatable({ long: "option", type: type() }),
152
- },
153
- positionals: [
154
- positionalVariadics({ type: type(), description: "Variadics" }),
155
- ],
156
- },
157
- async function (_, { options: { value }, positionals: [rest] }) {
158
- console.log(
159
- `Has executed: ${JSON.stringify(value)}, ${JSON.stringify(rest)}`,
160
- );
161
- },
162
- ),
147
+ operation({ options: {}, positionals: [] }, async function () {}),
163
148
  );
164
149
  console.log = onLogStdOut.call;
165
150
  console.error = onLogStdErr.call;
@@ -195,3 +180,21 @@ function makeMocked<P, R>(returns: Array<R>) {
195
180
  },
196
181
  };
197
182
  }
183
+
184
+ async function withEnv(
185
+ envName: string,
186
+ envValue: string,
187
+ callback: () => Promise<void>,
188
+ ) {
189
+ let beforeEnvValue = undefined;
190
+ if (envName in process.env) {
191
+ beforeEnvValue = process.env[envName];
192
+ }
193
+ process.env[envName] = envValue;
194
+ await callback();
195
+ if (beforeEnvValue === undefined) {
196
+ delete process.env[envName];
197
+ } else {
198
+ process.env[envName] = beforeEnvValue;
199
+ }
200
+ }
@@ -29,9 +29,9 @@ it("run", async function () {
29
29
  " subcommand Subcommand Description",
30
30
  "",
31
31
  "Options:",
32
- " --flag[=no] Option flag description",
33
- " --repeatable <string> [*] Option repeatable description",
34
- " --single-value <enum(number)> Option single value description",
32
+ " -ff, --flag[=no] Option flag description",
33
+ " -r, --repeatable <string> [*] Option repeatable description",
34
+ " -s, --single-value <enum(number)> Option single value description",
35
35
  "",
36
36
  ].join("\n");
37
37
  const subcommandUsage = [
@@ -46,10 +46,10 @@ it("run", async function () {
46
46
  " [variadic]... Variadics positional description",
47
47
  "",
48
48
  "Options:",
49
- " --flag[=no] Option flag description",
50
- " --repeatable <string> [*] Option repeatable description",
51
- " --single-value <enum(number)> Option single value description",
52
- " --url <url> [*] Option url description",
49
+ " -ff, --flag[=no] Option flag description",
50
+ " -r, --repeatable <string> [*] Option repeatable description",
51
+ " -s, --single-value <enum(number)> Option single value description",
52
+ " -u, --url <url> [*] Option url description",
53
53
  "",
54
54
  ].join("\n");
55
55
 
@@ -115,13 +115,19 @@ it("run", async function () {
115
115
  await testCase(
116
116
  ["--invalid1", "--invalid2", "required1", "--invalid3"],
117
117
  [],
118
- [rootUsage, "Error: Unexpected unknown option: --invalid1"],
118
+ [
119
+ rootUsage,
120
+ 'Error: Unknown option: "--invalid1": did you mean: --single-value, --help, --version ?',
121
+ ],
119
122
  1,
120
123
  );
121
124
  await testCase(
122
125
  ["required1", "unknown", "-wut", "--flag", "--single-value"],
123
126
  [],
124
- [rootUsage, 'Error: <subcommand>: Invalid value: "unknown"'],
127
+ [
128
+ rootUsage,
129
+ 'Error: <subcommand>: Unknown name: "unknown": did you mean: subcommand ?',
130
+ ],
125
131
  1,
126
132
  );
127
133
 
@@ -149,13 +155,19 @@ it("run", async function () {
149
155
  await testCase(
150
156
  ["--url", "https://example.com"],
151
157
  [],
152
- [rootUsage, "Error: Unexpected unknown option: --url"],
158
+ [
159
+ rootUsage,
160
+ 'Error: Unknown option: "--url": did you mean: --help, -r, --version ?',
161
+ ],
153
162
  1,
154
163
  );
155
164
  await testCase(
156
165
  ["required1", "--url", "https://example.com"],
157
166
  [],
158
- [rootUsage, "Error: Unexpected unknown option: --url"],
167
+ [
168
+ rootUsage,
169
+ 'Error: Unknown option: "--url": did you mean: --help, -r, --version ?',
170
+ ],
159
171
  1,
160
172
  );
161
173
  await testCase(
@@ -207,13 +219,19 @@ it("run", async function () {
207
219
  await testCase(
208
220
  ["--invalid", "required1", "subcommand", "required2"],
209
221
  [],
210
- [rootUsage, "Error: Unexpected unknown option: --invalid"],
222
+ [
223
+ rootUsage,
224
+ 'Error: Unknown option: "--invalid": did you mean: --single-value, --help, --flag ?',
225
+ ],
211
226
  1,
212
227
  );
213
228
  await testCase(
214
229
  ["required1", "subcommand", "required2", "--nope"],
215
230
  [],
216
- [subcommandUsage, "Error: Unexpected unknown option: --nope"],
231
+ [
232
+ subcommandUsage,
233
+ 'Error: Unknown option: "--nope": did you mean: --help, --flag, --repeatable ?',
234
+ ],
217
235
  1,
218
236
  );
219
237
  await testCase(
@@ -247,7 +265,7 @@ it("run", async function () {
247
265
  [],
248
266
  [
249
267
  subcommandUsage,
250
- 'Error: <required1>: Invalid value: "invalid" (expected one of: "required1" | "required1-bis")',
268
+ 'Error: <required1>: Unknown value: "invalid": did you mean: "required1-bis", "required1" ?',
251
269
  ],
252
270
  1,
253
271
  );
@@ -256,7 +274,7 @@ it("run", async function () {
256
274
  [],
257
275
  [
258
276
  subcommandUsage,
259
- 'Error: <required1>: Invalid value: "invalid" (expected one of: "required1" | "required1-bis")',
277
+ 'Error: <required1>: Unknown value: "invalid": did you mean: "required1-bis", "required1" ?',
260
278
  ],
261
279
  1,
262
280
  );
@@ -265,7 +283,7 @@ it("run", async function () {
265
283
  [],
266
284
  [
267
285
  subcommandUsage,
268
- 'Error: <required2>: Invalid value: "invalid" (expected one of: "required2" | "required2-bis")',
286
+ 'Error: <required2>: Unknown value: "invalid": did you mean: "required2-bis", "required2" ?',
269
287
  ],
270
288
  1,
271
289
  );
@@ -274,7 +292,7 @@ it("run", async function () {
274
292
  [],
275
293
  [
276
294
  subcommandUsage,
277
- 'Error: <required1>: Invalid value: "invalid" (expected one of: "required1" | "required1-bis")',
295
+ 'Error: <required1>: Unknown value: "invalid": did you mean: "required1-bis", "required1" ?',
278
296
  ],
279
297
  1,
280
298
  );
@@ -285,7 +303,7 @@ it("run", async function () {
285
303
  [],
286
304
  [
287
305
  subcommandUsage,
288
- 'Error: --single-value: <enum(number)>: from: enum(string): Invalid value: "dodo" (expected one of: "42" | "43")',
306
+ 'Error: --single-value: <enum(number)>: from: enum(string): Unknown value: "dodo": did you mean: "42", "43" ?',
289
307
  ],
290
308
  1,
291
309
  );
@@ -294,7 +312,7 @@ it("run", async function () {
294
312
  [],
295
313
  [
296
314
  subcommandUsage,
297
- 'Error: --single-value: <enum(number)>: from: enum(string): Invalid value: "44" (expected one of: "42" | "43")',
315
+ 'Error: --single-value: <enum(number)>: from: enum(string): Unknown value: "44": did you mean: "42", "43" ?',
298
316
  ],
299
317
  1,
300
318
  );
@@ -303,7 +321,10 @@ it("run", async function () {
303
321
  await testCase(
304
322
  ["--url", "not-a-url", "required1", "subcommand", "required2"],
305
323
  [],
306
- [rootUsage, "Error: Unexpected unknown option: --url"],
324
+ [
325
+ rootUsage,
326
+ 'Error: Unknown option: "--url": did you mean: --help, -r, --version ?',
327
+ ],
307
328
  1,
308
329
  );
309
330
  await testCase(
@@ -340,6 +361,62 @@ it("run", async function () {
340
361
  [subcommandUsage, "Error: --single-value: Must not be set multiple times"],
341
362
  1,
342
363
  );
364
+
365
+ // Test suggestions
366
+ await testCase(
367
+ ["required1", "subcommand", "required2", "-f"],
368
+ [],
369
+ [
370
+ subcommandUsage,
371
+ 'Error: Unknown option: "-f": did you mean: -ff, -r, -s ?',
372
+ ],
373
+ 1,
374
+ );
375
+ await testCase(
376
+ ["required1", "subcommand", "required2", "-flag"],
377
+ [],
378
+ [
379
+ subcommandUsage,
380
+ 'Error: Unknown option: "-flag": did you mean: --flag, -ff, --single-value ?',
381
+ ],
382
+ 1,
383
+ );
384
+ await testCase(
385
+ ["required1", "subcommand", "required2", "--uri"],
386
+ [],
387
+ [
388
+ subcommandUsage,
389
+ 'Error: Unknown option: "--uri": did you mean: --url, --version, -r ?',
390
+ ],
391
+ 1,
392
+ );
393
+ await testCase(
394
+ ["required1", "subcommand", "required2", "--single-"],
395
+ [],
396
+ [
397
+ subcommandUsage,
398
+ 'Error: Unknown option: "--single-": did you mean: --single-value, --help, --flag ?',
399
+ ],
400
+ 1,
401
+ );
402
+ await testCase(
403
+ ["required-bis1", "subcommand", "required2"],
404
+ [],
405
+ [
406
+ subcommandUsage,
407
+ 'Error: <required1>: Unknown value: "required-bis1": did you mean: "required1-bis", "required1" ?',
408
+ ],
409
+ 1,
410
+ );
411
+ await testCase(
412
+ ["required1", "subcomm"],
413
+ [],
414
+ [
415
+ rootUsage,
416
+ 'Error: <subcommand>: Unknown name: "subcomm": did you mean: subcommand ?',
417
+ ],
418
+ 1,
419
+ );
343
420
  });
344
421
 
345
422
  async function testCase(
@@ -364,22 +441,25 @@ async function testCase(
364
441
  options: {
365
442
  optionFlag: optionFlag({
366
443
  long: "flag",
444
+ short: "ff",
367
445
  description: "Option flag description",
368
446
  }),
369
447
  optionRepeatable: optionRepeatable({
370
448
  long: "repeatable",
449
+ short: "r",
371
450
  type: type(),
372
451
  description: "Option repeatable description",
373
452
  }),
374
453
  optionSingleValue: optionSingleValue({
375
454
  long: "single-value",
455
+ short: "s",
376
456
  type: typeConverted(
377
457
  "enum(number)",
378
458
  typeChoice("enum(string)", ["42", "43"]),
379
459
  (value) => Number(value),
380
460
  ),
381
461
  description: "Option single value description",
382
- defaultWhenNotDefined: () => 42,
462
+ defaultIfNotSpecified: () => 42,
383
463
  }),
384
464
  },
385
465
  positionals: [
@@ -401,8 +481,9 @@ async function testCase(
401
481
  options: {
402
482
  optionExtra: optionRepeatable({
403
483
  long: "url",
484
+ short: "u",
404
485
  description: "Option url description",
405
- type: typeUrl("url"),
486
+ type: typeUrl(),
406
487
  }),
407
488
  },
408
489
  positionals: [
@@ -17,7 +17,11 @@ it("run", async function () {
17
17
  );
18
18
  await testCase(
19
19
  ["--nope"],
20
- "{{Error:}@darkRed}+ Unexpected unknown option: {{--nope}@darkYellow}+",
20
+ '{{Error:}@darkRed}+ Unknown option: {{"--nope"}@darkYellow}+: did you mean: {{--help}@darkCyan}+, {{--flag}@darkCyan}+, {{--repeatable}@darkCyan}+ ?',
21
+ );
22
+ await testCase(
23
+ ["--repeat"],
24
+ '{{Error:}@darkRed}+ Unknown option: {{"--repeat"}@darkYellow}+: did you mean: {{--repeatable}@darkCyan}+, {{--help}@darkCyan}+, {{--flag}@darkCyan}+ ?',
21
25
  );
22
26
  await testCase(
23
27
  ["--flag", "--flag"],
@@ -58,7 +62,7 @@ async function testCase(args: Array<string>, error: string) {
58
62
  optionSingleValue: optionSingleValue({
59
63
  long: "single-value",
60
64
  type: typeUrl("location"),
61
- defaultWhenNotDefined: () => undefined,
65
+ defaultIfNotSpecified: () => undefined,
62
66
  }),
63
67
  optionRepeatable: optionRepeatable({
64
68
  long: "repeatable",