From 1bf5470c280cc20476d7bc067da1608a2988d895 Mon Sep 17 00:00:00 2001 From: so1ve Date: Wed, 17 Dec 2025 03:59:03 +0800 Subject: [PATCH 1/3] fix: should complete options after boolean option --- src/t.ts | 5 ++++- tests/cli.test.ts | 7 +++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/t.ts b/src/t.ts index 601c7ff..8dabcaa 100644 --- a/src/t.ts +++ b/src/t.ts @@ -261,7 +261,10 @@ export class RootCommand extends Command { const [flag] = toComplete.split('='); optionName = flag; } else if (lastPrevArg?.startsWith('-')) { - optionName = lastPrevArg; + const option = this.findOption(command, lastPrevArg); + if (option && !option.isBoolean) { + optionName = lastPrevArg; + } } if (optionName) { diff --git a/tests/cli.test.ts b/tests/cli.test.ts index 20e5a00..0822ee1 100644 --- a/tests/cli.test.ts +++ b/tests/cli.test.ts @@ -110,6 +110,13 @@ describe.each(cliTools)('cli completion tests for %s', (cliTool) => { // Should complete subcommands that start with 's' even after a boolean option expect(output).toContain('start'); }); + + it('should not interfere with option completion after boolean options', async () => { + const command = `${commandPrefix} dev --verbose --h`; + const output = await runCommand(command); + // Should complete subcommands that start with 's' even after a boolean option + expect(output).toContain('--host'); + }); }); describe.runIf(!shouldSkipTest)('option API overload tests', () => { From f4021b02aa3fba184fd09505114507410382a594 Mon Sep 17 00:00:00 2001 From: Ray Date: Wed, 17 Dec 2025 04:45:26 +0800 Subject: [PATCH 2/3] Create warm-pants-roll.md --- .changeset/warm-pants-roll.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/warm-pants-roll.md diff --git a/.changeset/warm-pants-roll.md b/.changeset/warm-pants-roll.md new file mode 100644 index 0000000..2c404f5 --- /dev/null +++ b/.changeset/warm-pants-roll.md @@ -0,0 +1,5 @@ +--- +"@bomb.sh/tab": patch +--- + +fix: should complete options after boolean option From 5e6828125041b7af71cab6e50a25f82c0331fd43 Mon Sep 17 00:00:00 2001 From: AmirSa12 Date: Sun, 21 Dec 2025 19:47:16 +0330 Subject: [PATCH 3/3] prettier --- .changeset/warm-pants-roll.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.changeset/warm-pants-roll.md b/.changeset/warm-pants-roll.md index 2c404f5..1431280 100644 --- a/.changeset/warm-pants-roll.md +++ b/.changeset/warm-pants-roll.md @@ -1,5 +1,5 @@ --- -"@bomb.sh/tab": patch +'@bomb.sh/tab': patch --- fix: should complete options after boolean option