Skip to content

feat(commander): use Commander for determining integration details#131

Merged
AmirSa12 merged 3 commits into
bombshell-dev:mainfrom
shadowspawn:improve-commander-adapter
Jun 15, 2026
Merged

feat(commander): use Commander for determining integration details#131
AmirSa12 merged 3 commits into
bombshell-dev:mainfrom
shadowspawn:improve-commander-adapter

Conversation

@shadowspawn

@shadowspawn shadowspawn commented Jun 13, 2026

Copy link
Copy Markdown
Contributor

What does this PR do?

Use Commander built-in support to automatically handle:

  • hidden options and commands
  • built-in help command and help option
  • all supported option short and long flag separators (e.g. -d| --debug, -d --debug)
  • non-alphanumeric short options (e.g. -%)

Added automatic option completion for options with choices (like already done for arguments).

I removed the code excluding complete from the subcommands, and left it to Commander. This means the completion command is offered as a completion since it is visible in the help.

  • Bug fix
  • Feature
  • Refactor (no behavior change)
  • Documentation
  • Performance improvement
  • Tests
  • Chore (dependencies, CI, tooling)

Checklist

  • All tests pass (pnpm test)
  • Files are formatted (pnpm format)
  • I have added/updated tests for my changes (if applicable)
  • I have added a changeset

AI-generated code disclosure

  • This PR includes AI-generated code

@changeset-bot

changeset-bot Bot commented Jun 13, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 8723cdb

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@bomb.sh/tab Patch

Not sure what this means? Click here to learn what changesets are.

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

@pkg-pr-new

pkg-pr-new Bot commented Jun 13, 2026

Copy link
Copy Markdown

Open in StackBlitz

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

commit: 8723cdb

@shadowspawn shadowspawn force-pushed the improve-commander-adapter branch from 0ca6973 to b7e66a0 Compare June 13, 2026 23:58
@shadowspawn

Copy link
Copy Markdown
Contributor Author

I have not added built-in support for `choices, like done for arguments:

tab/src/commander.ts

Lines 174 to 182 in 53ea5e1

const choices = arg.argChoices;
if (choices?.length) {
tabCommand.argument(
arg.name(),
(complete) => {
for (const choice of choices) complete(choice, '');
},
arg.variadic
);

I could do that in this PR, or leave that for @AmirSa12 if you prefer to do it yourself?

@AmirSa12

AmirSa12 commented Jun 14, 2026

Copy link
Copy Markdown
Member

I have not added built-in support for `choices, like done for arguments:

tab/src/commander.ts

Lines 174 to 182 in 53ea5e1

const choices = arg.argChoices;
if (choices?.length) {
tabCommand.argument(
arg.name(),
(complete) => {
for (const choice of choices) complete(choice, '');
},
arg.variadic
);

I could do that in this PR, or leave that for @AmirSa12 if you prefer to do it yourself?

This PR is really amazing! The commander adapter is becoming the most well-designed adapter in tab thanks to your work!
Please feel free to do it in this PR if you'd like!

@shadowspawn

Copy link
Copy Markdown
Contributor Author

Added automatic support for choices on options, and upgraded suggested type from Bug fix to Feature.

@AmirSa12 AmirSa12 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LFG!!!

@AmirSa12 AmirSa12 changed the title Use Commander for determining integration details feat(commander): use Commander for determining integration details Jun 15, 2026
@AmirSa12 AmirSa12 merged commit 314d836 into bombshell-dev:main Jun 15, 2026
10 checks passed
@bombshell-bot bombshell-bot Bot mentioned this pull request Jun 15, 2026
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.

2 participants