Skip to content

Use Commander for determining integration details#131

Open
shadowspawn wants to merge 1 commit into
bombshell-dev:mainfrom
shadowspawn:improve-commander-adapter
Open

Use Commander for determining integration details#131
shadowspawn wants to merge 1 commit into
bombshell-dev:mainfrom
shadowspawn:improve-commander-adapter

Conversation

@shadowspawn

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 short and long flag separators (e.g. -d| --debug, -d --debug)
  • non-alphanumeric short options (e.g. -%)

I also 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.

(This could be classed as a bug fix or a feature.)

  • 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

⚠️ No Changeset found

Latest commit: b7e66a0

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

@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: b7e66a0

@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!

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