Skip to content

Rework complete command for Commander#125

Open
shadowspawn wants to merge 3 commits into
bombshell-dev:mainfrom
shadowspawn:rework-complete-command
Open

Rework complete command for Commander#125
shadowspawn wants to merge 3 commits into
bombshell-dev:mainfrom
shadowspawn:rework-complete-command

Conversation

@shadowspawn
Copy link
Copy Markdown
Contributor

@shadowspawn shadowspawn commented Jun 5, 2026

Rework Commander framework implementation to remove need to monkeypatch .parse()+.parseAsync(), and optionally allow separate complete and completion commands. Commander allows customising name of other built-in commands and options like version and help.

With separate commands, can show correct user facing syntax completion <shell> and not need to detect difference between completion (complete <shell>) and complete (complete -- [args]).

If maintainers ok with this approach, I'll mention the customisation option in the README.

…ommands, and remove need to monkeypatch parse+parseAsync
@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Jun 5, 2026

⚠️ No Changeset found

Latest commit: d6ae48e

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@shadowspawn
Copy link
Copy Markdown
Contributor Author

shadowspawn commented Jun 5, 2026

This is the UX experience with the tab-style combo complete command.

% my-cmd --help
Usage: my-cmd [options] [command]

Options:
  -V, --version     output the version number
  -h, --help        display help for command

Commands:
  serve [options]   Start the server
  complete [shell]  Generate shell completion scripts
  help [command]    display help for command
% my-cmd complete --help
Usage: my-cmd complete [options] [shell]

Generate shell completion scripts

Arguments:
  shell       shell type (choices: "zsh", "bash", "fish", "powershell")

Options:
  -h, --help  display help for command
% my-cmd complete       
error: missing required argument 'shell'
% my-cmd complete x
error: command-argument value 'x' is invalid for argument 'shell'. Allowed choices are zsh, bash, fish, powershell.

This is the UX experience with a custom name (completion) for the visible script command.

% my-cmd --help         
Usage: my-cmd [options] [command]

Options:
  -V, --version       output the version number
  -h, --help          display help for command

Commands:
  serve [options]     Start the server
  completion <shell>  Generate shell completion scripts
  help [command]      display help for command
% my-cmd complete --help
Usage: my-cmd complete complete -- [args...]

Generate completion suggestions

Options:
  -h, --help  display help for command
% my-cmd completion --help 
Usage: my-cmd completion [options] <shell>

Generate shell completion scripts

Arguments:
  shell       Shell type for completion script (choices: "zsh", "bash", "fish", "powershell")

Options:
  -h, --help  display help for command
% my-cmd completion
error: missing required argument 'shell'
% my-cmd completion x
error: command-argument value 'x' is invalid for argument 'shell'. Allowed choices are zsh, bash, fish, powershell.

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented Jun 5, 2026

Open in StackBlitz

npm i https://pkg.pr.new/@bomb.sh/tab@125

commit: d6ae48e

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant