Skip to content

Conversation

TiagoMaiaL
Copy link
Contributor

@TiagoMaiaL TiagoMaiaL commented Oct 11, 2025

This PR fixes part of the behavior described in #778, fixing the generated error and usage texts to not list the builtin -h, --help:

I would expect -h to only be added if no existing flag or option already has that name.

I still need to address the other behaviors there, and to fix command invocation, applying the custom command and not the builtin help one.

Before

Error: Missing expected argument '<phrase>'

USAGE: repeat [--count <count>] [--include-counter] <phrase> --horse <horse>

ARGUMENTS:
  <phrase>                The phrase to repeat.

OPTIONS:
  --count <count>         How many times to repeat 'phrase'.
  --include-counter       Include a counter with each repetition.
  -h, --horse <horse>     The name of the talking horse.
  -h, --help              Show help information.

After

Error: Missing expected argument '<phrase>'

USAGE: repeat [--count <count>] [--include-counter] <phrase> --horse <horse>

ARGUMENTS:
  <phrase>                The phrase to repeat.

OPTIONS:
  --count <count>         How many times to repeat 'phrase'.
  --include-counter       Include a counter with each repetition.
  -h, --horse <horse>     The name of the talking horse.

Checklist

  • I've added at least one test that validates that my change is working, if appropriate
  • I've followed the code style of the rest of the project
  • I've read the Contribution Guidelines
  • I've updated the documentation if necessary

Fixes part of the behavior described in issue 778 (apple#778).
@TiagoMaiaL TiagoMaiaL changed the title #778: Suppress builtin -h,--help when command already contains an option using -h #778: Suppress builtin -h,--help from usage text when command already contains an option using -h Oct 13, 2025
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