unjs / unjs/citty

Built-in help/version flags are not shown in usage output

Open
#280 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Describe the feature

I'm using Citty's built-in -h/--help and -v/--version, but they don't show up in the usage output at all. Users have no way to discover them unless they already know the flags exist.

Current workarounds both lose the built-in behavior:

  • declare them as args (have to reimplement help/version)
  • write a fully custom showUsage (lose renderUsage entirely).

Since the built-in flags are injected at the runMain level, an option on runMainOptions to show them in the usage output could be a fix. Happy to help if the idea

Additional information
  • Would you be willing to help implement this feature?

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

Start at the runMain entry point and inspect how runMainOptions injects the built-in -h/--help and -v/--version flags before usage is rendered. Trace renderUsage and add an option that includes those built-ins in the usage output while preserving their existing behavior; done when both flags are discoverable without custom argument declarations or showUsage.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
cli
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.