Skip to content

Fix subcommand help displaying main help instead of specific help (#2483) - #2500

Merged
AucaCoyan merged 1 commit into
espanso:devfrom
gcailly:fix-subcommand-help-2483
Oct 5, 2025
Merged

AucaCoyan merged 1 commit into
espanso:devfrom
gcailly:fix-subcommand-help-2483

Conversation

@gcailly

@gcailly gcailly commented Oct 4, 2025

Copy link
Copy Markdown
Contributor

When running commands like espanso service --help or espanso package --help, the CLI was displaying the main application help instead of the specific subcommand help.

This was caused by using clap_instance.print_help() which always prints the root command help, instead of using err.exit() which properly handles contextual help for subcommands.

Fixes #2483

…panso#2483)

When running commands like `espanso service --help` or `espanso package --help`,
the CLI was displaying the main application help instead of the specific
subcommand help.

This was caused by using `clap_instance.print_help()` which always prints
the root command help, instead of using `err.exit()` which properly handles
contextual help for subcommands.

Fix: Use `err.exit()` to let Clap handle contextual help display.

Fixes espanso#2483
@gcailly
gcailly requested a review from AucaCoyan as a code owner October 4, 2025 07:15
@gcailly

gcailly commented Oct 4, 2025

Copy link
Copy Markdown
Contributor Author

P.S. I am new to contributions and PR, I hope I made no mistakes...

@AucaCoyan

Copy link
Copy Markdown
Collaborator

Thank you! This is perfect ❤️ . Welcome to the project!

@AucaCoyan
AucaCoyan merged commit 514f06e into espanso:dev Oct 5, 2025
sboldt1978 pushed a commit to sboldt1978/espanso that referenced this pull request Feb 11, 2026
…panso#2483) (espanso#2500)

When running commands like `espanso service --help` or `espanso package --help`,
the CLI was displaying the main application help instead of the specific
subcommand help.

This was caused by using `clap_instance.print_help()` which always prints
the root command help, instead of using `err.exit()` which properly handles
contextual help for subcommands.

Fix: Use `err.exit()` to let Clap handle contextual help display.

Fixes espanso#2483
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.

CLI --help subcommand returns standard help text and not that of the subcommand (macOS)

2 participants