Skip to content

Fix OptionParser subcommand help to respect custom summary_indent#16334

Merged
straight-shoota merged 1 commit intocrystal-lang:masterfrom
kojix2:subcommand-custom-indent
Nov 25, 2025
Merged

Fix OptionParser subcommand help to respect custom summary_indent#16334
straight-shoota merged 1 commit intocrystal-lang:masterfrom
kojix2:subcommand-custom-indent

Conversation

@kojix2
Copy link
Contributor

@kojix2 kojix2 commented Nov 6, 2025

Hi

This PR fixes a bug in OptionParser#handle_flag where subcommand help output did not respect custom summary_indent settings.

This change only affects help message formatting (to_s output)

help.should eq <<-USAGE
Usage: foo subcommand
||--help Help
||--local Local flag
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Note on Flag Ordering
In the help output, common flags like --help appear before subcommand-specific flags like --local. This happens because OptionParser shows flags in the order they are registered.

This may not be the best user experience, but fixing the flag order is not part of this PR.

@Blacksmoke16 Blacksmoke16 added kind:bug A bug in the code. Does not apply to documentation, specs, etc. topic:stdlib labels Nov 6, 2025
@straight-shoota straight-shoota added this to the 1.19.0 milestone Nov 24, 2025
@straight-shoota straight-shoota changed the title Fix OptionParser subcommand help to respect custom summary_indent Fix OptionParser subcommand help to respect custom summary_indent Nov 25, 2025
@straight-shoota straight-shoota merged commit af61d97 into crystal-lang:master Nov 25, 2025
42 checks passed
@kojix2 kojix2 deleted the subcommand-custom-indent branch November 26, 2025 01:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind:bug A bug in the code. Does not apply to documentation, specs, etc. topic:stdlib

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants