unjs / unjs/citty

main command's positional arg's value is the same as a subCommand name

Open
#41 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
1.3k
Forks
58
PR merge metrics
No merged PRs in 30d

Description

Environment

v16.14.2

Reproduction

https://stackblitz.com/edit/stackblitz-starters-qggkrd?file=index.js

Describe the bug

when the main command's first positional arg's value is the same as a subCommand name
the subCommand runs and the main command runs with the positional arg's value

Additional context

No response

Logs

No response

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Open the StackBlitz reproduction and inspect index.js, focusing on how the main command dispatches its first positional argument when that value matches a subCommand name. Reproduce the behavior and trace command selection; done means the positional argument no longer unexpectedly causes the subCommand to run alongside the main command.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
cli
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.