feat: support single-character flags #27
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Closes #26
Changes:
flagName
sTests:
git commit -am hello
)Note:
I was surprised it was as easy as this. And from playing around it seems that type-flag doesn't seem to care if you use
--
or-
, for flags of any length. For examplefoo --message hello
andfoo -message hello
both seem to work. Likewisefoo -m hello
andfoo --m hello
.I wasn't sure if this was deliberate, I couldn't find it in the docs. But either way, I wanted to get this in along with test cases. So if the above is considered a bug, not regressing support for single-character flags would be part of the fix requirements if this goes in first.
Another note:
For this to make its way to cleye, there might be some special-casing needed for the
--help
renderer (to avoid suggesting--x 1
usage instead of-x 1
(although both work as noted above)). I can help with that too if you'd like, once this or something like it is published.