Skip to content

Avoid duplicate argument placeholders in Crystal CLI help - #17162

Open
kojix2 wants to merge 1 commit into
crystal-lang:masterfrom
kojix2:help-arg
Open

Avoid duplicate argument placeholders in Crystal CLI help#17162
kojix2 wants to merge 1 commit into
crystal-lang:masterfrom
kojix2:help-arg

Conversation

@kojix2

@kojix2 kojix2 commented Jul 25, 2026

Copy link
Copy Markdown
Contributor

Hello.

This pull request proposes changing the help messages for the Crystal compiler.
It does not intend to change the compiler behavior.

Currently, some options show the same argument placeholder for both the short and long forms.

-o FILE, --output FILE

This looks a little redundant, especially after indentation was added for long options.

I considered changing OptionParser behavior, but that would affect how users can format their own help messages.
So this pull request only updates the option definitions used by the Crystal compiler.

With this change, the argument placeholder is kept only on the long option.

-o, --output FILE

There are variations in argument notation, such as --foo BAR, --foo=BAR, and --foo <bar>.
However, they are outside the scope of this pull request.

Thank you.

@straight-shoota

Copy link
Copy Markdown
Member

I'm not sure if this is a good change. It makes the help text more concise, but also less clear.
-o FILE, --output FILE is pretty obvious what it means, -o, --output FILE less so. -o could be a standalone flag which does not receive a value.

@kojix2

kojix2 commented Jul 26, 2026

Copy link
Copy Markdown
Contributor Author

-o, --output FILE conventionally means that both forms take the same argument.
If -o were a standalone flag while --output took a value, they should be defined as separate options.

Another possibility is for OptionParser to normalize the help text. For example:

opts.on("-o FILE", "--output FILE", "Output path.")

could be displayed as:

    -o, --output FILE                Output path.

Ruby’s OptionParser does this. However, it would be a behavior change that reduces control over the help output.

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