Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add summary_width and summary_indent to OptionParser in Crystal #15326

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

kojix2
Copy link
Contributor

@kojix2 kojix2 commented Jan 7, 2025

Hi!
This pull request introduces enhancements to the OptionParser in Crystal
These features are similar to the summary_width and summary_indent found in Ruby's OptionParser.
See #14153

Motivation

Currently, the indentation settings in OptionParser are hard-coded, which can limit the flexibility and fun of creating command line tools. The default width is set to 32, the same as the Ruby default, which is too wide for many use cases. Being able to customize these settings would be beneficial for a variety of command line utilities.

Implementation

With the help of ChatGPT and Gemni, I looked into how these features are provided in major programming languages, but the naming and APIs vary across languages ​​and libraries, and best practices are unclear. So I simply went for the Ruby approach.

Actually, I don't really care about this approach or implementation. I hate the fact that you can't specify indentation in the standard library, so I submitted it because I thought no one would touch it unless I submitted a pull request.
I'm willing to close this if someone provides a better pull request.

Thank you.

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.

1 participant