Skip to content

Commit 234d3e0

Browse files
committed
fix(help): include request-timeout in global flag guidance
1 parent 15e95de commit 234d3e0

4 files changed

Lines changed: 32 additions & 18 deletions

File tree

src/lib/output.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@ export type OutputMode = 'json' | 'text';
33
/**
44
* Help-text footer pointing at the global options surface so users
55
* looking at any subcommand `--help` don't miss `--dry-run`, `--output`,
6-
* `--profile`, `--endpoint-url`, `--debug`.
6+
* `--profile`, `--endpoint-url`, `--request-timeout`, `--debug`.
77
*/
88
export const GLOBAL_OPTS_HINT =
9-
'\nGlobal options (--dry-run, --output, --profile, --endpoint-url, --verbose, --debug):' +
9+
'\nGlobal options (--dry-run, --output, --profile, --endpoint-url, --request-timeout, --verbose, --debug):' +
1010
'\n testsprite --help';
1111

1212
export function isOutputMode(value: unknown): value is OutputMode {

src/lib/render-error.test.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,12 @@ describe('rephraseUnknownOption', () => {
3737
expect(result).toContain('--endpoint-url');
3838
});
3939

40+
it('rephrases --request-timeout placed after subcommand', () => {
41+
const result = rephraseUnknownOption("error: unknown option '--request-timeout'");
42+
expect(result).not.toBeNull();
43+
expect(result).toContain('--request-timeout');
44+
});
45+
4046
it('rephrases --debug placed after subcommand', () => {
4147
const result = rephraseUnknownOption("error: unknown option '--debug'");
4248
expect(result).not.toBeNull();
@@ -87,6 +93,12 @@ describe('rephraseUnknownOption', () => {
8793
expect(result).not.toBeNull();
8894
expect(result).toContain('testsprite --endpoint-url <value> <subcommand>');
8995
});
96+
97+
it('value flag (--request-timeout) example DOES include a <value> placeholder', () => {
98+
const result = rephraseUnknownOption("error: unknown option '--request-timeout'");
99+
expect(result).not.toBeNull();
100+
expect(result).toContain('testsprite --request-timeout <value> <subcommand>');
101+
});
90102
});
91103

92104
describe('renderCommanderError', () => {

src/lib/render-error.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,15 @@ import type { OutputMode } from './output.js';
1111
*
1212
* `boolean` flags (--dry-run, --debug, --verbose) take no value; emit
1313
* example without a placeholder. `value` flags (--output, --profile,
14-
* --endpoint-url) take a single argument; emit example with `<value>`.
14+
* --endpoint-url, --request-timeout) take a single argument; emit example
15+
* with `<value>`.
1516
*/
1617
const GLOBAL_FLAG_ARITY: Record<string, 'boolean' | 'value'> = {
1718
'dry-run': 'boolean',
1819
output: 'value',
1920
profile: 'value',
2021
'endpoint-url': 'value',
22+
'request-timeout': 'value',
2123
debug: 'boolean',
2224
verbose: 'boolean',
2325
};

test/__snapshots__/help.snapshot.test.ts.snap

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ Options:
3434
destroyed.
3535
-h, --help display help for command
3636
37-
Global options (--dry-run, --output, --profile, --endpoint-url, --verbose, --debug):
37+
Global options (--dry-run, --output, --profile, --endpoint-url, --request-timeout, --verbose, --debug):
3838
testsprite --help
3939
"
4040
`;
@@ -47,7 +47,7 @@ List supported agent targets, their status, and landing paths
4747
Options:
4848
-h, --help display help for command
4949
50-
Global options (--dry-run, --output, --profile, --endpoint-url, --verbose, --debug):
50+
Global options (--dry-run, --output, --profile, --endpoint-url, --request-timeout, --verbose, --debug):
5151
testsprite --help
5252
"
5353
`;
@@ -84,7 +84,7 @@ exports[`--help snapshots > auth logout 1`] = `
8484
Options:
8585
-h, --help display help for command
8686
87-
Global options (--dry-run, --output, --profile, --endpoint-url, --verbose, --debug):
87+
Global options (--dry-run, --output, --profile, --endpoint-url, --request-timeout, --verbose, --debug):
8888
testsprite --help
8989
"
9090
`;
@@ -95,7 +95,7 @@ exports[`--help snapshots > auth whoami 1`] = `
9595
Options:
9696
-h, --help display help for command
9797
98-
Global options (--dry-run, --output, --profile, --endpoint-url, --verbose, --debug):
98+
Global options (--dry-run, --output, --profile, --endpoint-url, --request-timeout, --verbose, --debug):
9999
testsprite --help
100100
"
101101
`;
@@ -151,7 +151,7 @@ Get a project by id
151151
Options:
152152
-h, --help display help for command
153153
154-
Global options (--dry-run, --output, --profile, --endpoint-url, --verbose, --debug):
154+
Global options (--dry-run, --output, --profile, --endpoint-url, --request-timeout, --verbose, --debug):
155155
testsprite --help
156156
"
157157
`;
@@ -173,7 +173,7 @@ Options:
173173
--max-items <n> stop after this many items across auto-paged pages
174174
-h, --help display help for command
175175
176-
Global options (--dry-run, --output, --profile, --endpoint-url, --verbose, --debug):
176+
Global options (--dry-run, --output, --profile, --endpoint-url, --request-timeout, --verbose, --debug):
177177
testsprite --help
178178
"
179179
`;
@@ -278,7 +278,7 @@ Options:
278278
source body; json mode: wire envelope)
279279
-h, --help display help for command
280280
281-
Global options (--dry-run, --output, --profile, --endpoint-url, --verbose, --debug):
281+
Global options (--dry-run, --output, --profile, --endpoint-url, --request-timeout, --verbose, --debug):
282282
testsprite --help
283283
"
284284
`;
@@ -313,7 +313,7 @@ Options:
313313
per invocation; pin one yourself for safe retries.
314314
-h, --help display help for command
315315
316-
Global options (--dry-run, --output, --profile, --endpoint-url, --verbose, --debug):
316+
Global options (--dry-run, --output, --profile, --endpoint-url, --request-timeout, --verbose, --debug):
317317
testsprite --help
318318
"
319319
`;
@@ -329,7 +329,7 @@ Options:
329329
--failed-only Keep only the failed step plus its immediate neighbors (±1)
330330
-h, --help display help for command
331331
332-
Global options (--dry-run, --output, --profile, --endpoint-url, --verbose, --debug):
332+
Global options (--dry-run, --output, --profile, --endpoint-url, --request-timeout, --verbose, --debug):
333333
testsprite --help
334334
"
335335
`;
@@ -342,7 +342,7 @@ Get a test by id
342342
Options:
343343
-h, --help display help for command
344344
345-
Global options (--dry-run, --output, --profile, --endpoint-url, --verbose, --debug):
345+
Global options (--dry-run, --output, --profile, --endpoint-url, --request-timeout, --verbose, --debug):
346346
testsprite --help
347347
"
348348
`;
@@ -367,7 +367,7 @@ Options:
367367
--max-items <n> stop after this many items across auto-paged pages
368368
-h, --help display help for command
369369
370-
Global options (--dry-run, --output, --profile, --endpoint-url, --verbose, --debug):
370+
Global options (--dry-run, --output, --profile, --endpoint-url, --request-timeout, --verbose, --debug):
371371
testsprite --help
372372
"
373373
`;
@@ -431,7 +431,7 @@ Dry-run shape notes:
431431
omit \`closure\` (or return it as null) since there is no dependency expansion.
432432
• \`autoHeal\` defaults true for FE reruns; BE reruns ignore the field entirely.
433433
434-
Global options (--dry-run, --output, --profile, --endpoint-url, --verbose, --debug):
434+
Global options (--dry-run, --output, --profile, --endpoint-url, --request-timeout, --verbose, --debug):
435435
testsprite --help
436436
"
437437
`;
@@ -463,7 +463,7 @@ Options:
463463
--cursor <token> with --history: opaque cursor from a prior page
464464
-h, --help display help for command
465465
466-
Global options (--dry-run, --output, --profile, --endpoint-url, --verbose, --debug):
466+
Global options (--dry-run, --output, --profile, --endpoint-url, --request-timeout, --verbose, --debug):
467467
testsprite --help
468468
"
469469
`;
@@ -514,7 +514,7 @@ Dependency-aware fresh run (M4):
514514
BE tests can declare --produces/--needs at create time to drive wave ordering
515515
(see \`testsprite test create --help\` for details).
516516
517-
Global options (--dry-run, --output, --profile, --endpoint-url, --verbose, --debug):
517+
Global options (--dry-run, --output, --profile, --endpoint-url, --request-timeout, --verbose, --debug):
518518
testsprite --help
519519
"
520520
`;
@@ -537,7 +537,7 @@ Options:
537537
excluded when this flag is set.
538538
-h, --help display help for command
539539
540-
Global options (--dry-run, --output, --profile, --endpoint-url, --verbose, --debug):
540+
Global options (--dry-run, --output, --profile, --endpoint-url, --request-timeout, --verbose, --debug):
541541
testsprite --help
542542
"
543543
`;

0 commit comments

Comments
 (0)