Skip to content

Add support for generating short flags for options. Fixes #33 #36

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

Merged
merged 3 commits into from
May 2, 2017

Conversation

Gabriella439
Copy link
Owner

This adds a new shortNameModifier to the Modifiers record which is
used to optionally generate a short flag for labeled fields

This change also updates the documentation around how to use Modifiers

This adds a new `shortNameModifier` to the `Modifiers` record which is
used to optionally generate a short flag for labeled fields

This change also updates the documentation around how to use `Modifiers`
@JamesMcMahon
Copy link

This looks really good. The documentation will be really helpful.

The only constructive comment I have is that short options are a very common feature for option parsers. While I think the parseRecordWithModifiers method is a lot more powerful and extensible, it might be nice to additionally have something out of the box to support short names.

@Gabriella439
Copy link
Owner Author

The main reason that this does not add short names out of the box is that there is a pretty high likelihood that they will conflict if two fields share the same first letter

@JamesMcMahon
Copy link

That makes sense, you would want to break the API for existing users. You might be able to add an option to explicitly turn it on.

This picks the common default where you use the first letter of each
option as the short name
@Gabriella439
Copy link
Owner Author

I added a firstLetter utility, which you can use to turn that option on

@Gabriella439 Gabriella439 merged commit 07b6dac into master May 2, 2017
@Gabriella439 Gabriella439 deleted the gabriel/shortname branch May 2, 2017 15:49
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