Skip to content

chore: simplify scanArguments - #156

Open
shadowspawn wants to merge 1 commit into
bombshell-dev:fix/commander-parserfrom
shadowspawn:simplify-scanArguments
Open

shadowspawn wants to merge 1 commit into
bombshell-dev:fix/commander-parserfrom
shadowspawn:simplify-scanArguments

Conversation

@shadowspawn

@shadowspawn shadowspawn commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

What does this PR do?

Suggested simplification to scanArguments in PR #155

I am not sure what the current code for canMatchCommand is worrying about, and not sure I understand the context correctly. Doing a PR so easy to see the difference and can discuss in context.

I think the command path built using the "parts" will get hits each time find a part is added until reach leaf command, then will get misses from then on (assuming there are no missing intermediate commands in deeply nested commands)

If I am right:

  1. no point in doing the loop Array.from(this.commands.keys()).some(), just stop matching when get first miss.
  2. don't actually need to track canMatchCommand at all, if don't mind all the command-arguments calling this.commands.get(commandPath) and getting undefined.

This PR does (1). Stop matching after get first miss.

Type of change

  • 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 Oct 21, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 09a6f0d

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 Oct 21, 2026

Copy link
Copy Markdown

Open in StackBlitz

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

commit: 09a6f0d

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