Skip to content

display help instead of silently exiting on empty subcommands - #978

Merged
HalFrgrd merged 1 commit into
HalFrgrd:masterfrom
elseawhy:improve-cli-help
Aug 31, 2026
Merged

display help instead of silently exiting on empty subcommands#978
HalFrgrd merged 1 commit into
HalFrgrd:masterfrom
elseawhy:improve-cli-help

Conversation

@elseawhy

Copy link
Copy Markdown
Contributor

Previously, running commands without arguments had inconsistent UX

Commands with optional arguments, like suggestions, mouse, editor would parse successfully, do nothing and silently exit:
2026-08-31_23-08-1788190270

Commands with required arguments, like perf, create-prompt-widget would print a help menu without any colour on the fonts and return a non-zero exit code (notice the red > on the screenshot):
2026-08-31_23-08-1788190317

What i did was adding arg_required_else_help = true to all subcommands that currently exit silently when no arguments are passed to it. I also updated the match arm in cli.rs to correctly handle ErrorKind::DisplayHelpOnMissingArgumentOrSubcommand, now it should print help menu and exit successfully. Also added color = clap::ColorChoice::Always to FlylineArgs for consistency.

Here is what it looks like after:
2026-08-31_23-08-1788190907

@HalFrgrd HalFrgrd left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great, thank you!

@HalFrgrd
HalFrgrd merged commit 1406e1d into HalFrgrd:master Aug 31, 2026
@elseawhy
elseawhy deleted the improve-cli-help branch August 31, 2026 16:37
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.

2 participants