GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fix help hint showing shadowed option name by Mr-Neutr0n · Pull Request #3208 · pallets/click

Conversation

@Mr-Neutr0n

@Mr-Neutr0n Mr-Neutr0n commented Feb 14, 2026

Copy link
Copy Markdown
Contributor

Fixes #2790.

When a subcommand defines an option that shadows one of the configured help option names (e.g. -h), the error hint was still suggesting the shadowed name:

Try 'cli foo -h' for help.

But -h is now the subcommand's --host option, not help. Running cli foo -h gives Error: Option '-h' requires an argument. instead of showing help.

The fix uses get_help_option_names() which already exists and filters out names claimed by other parameters. So now the hint picks a working alternative like --help:

Try 'cli foo --help' for help.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@Mr-Neutr0n Mr-Neutr0n mentioned this pull request Feb 14, 2026
Nested command option shadowing -h prints wrong suggestion #2790
Closed
@kdeldycke
kdeldycke changed the base branch from main to stable April 16, 2026 09:34
@kdeldycke kdeldycke added this to the 8.4.0 milestone Apr 21, 2026
@kdeldycke

kdeldycke commented Apr 21, 2026

Copy link
Copy Markdown
Collaborator

I just reworked that PR to be more resilient against various cases of default option names overriding. Also added unittests to illustrate all these edge-cases.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@kdeldycke kdeldycke added bug help output Help text formatting, layout, and --help rendering labels Apr 21, 2026
@kdeldycke @Mr-Neutr0n
Use non-shadowed help option name in error hint
1241aba
Fix #2790.

Co-authored-by: Mr-Neutr0n <[email protected]>
@kdeldycke kdeldycke mentioned this pull request Apr 22, 2026
help not resolving automatically #2819
Closed
@kdeldycke
kdeldycke requested review from Rowlando13 and davidism April 27, 2026 15:01
@Rowlando13
Move changes to correct section
a34f960
@Rowlando13
Rowlando13 changed the base branch from stable to main April 29, 2026 06:57
@Rowlando13
Merge branch 'main' into fix/help-option-shadowing-suggestion
2d0490b
@Rowlando13
Rowlando13 merged commit 0cd28d6 into pallets:main Apr 29, 2026
11 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@github-actions github-actions Bot locked as resolved and limited conversation to collaborators May 14, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Reviewers

@davidism davidism Awaiting requested review from davidism
@Rowlando13 Rowlando13 Awaiting requested review from Rowlando13

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

help output Help text formatting, layout, and --help rendering

Projects

None yet

Milestone

8.4.0

Development

Successfully merging this pull request may close these issues.

Nested command option shadowing -h prints wrong suggestion

Uh oh!

There was an error while loading. Please reload this page.

3 participants

@Mr-Neutr0n @kdeldycke @Rowlando13
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.