-
-
Notifications
You must be signed in to change notification settings - Fork 3
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
feat: support single-character flags #27
base: develop
Are you sure you want to change the base?
Conversation
So
type-flag/tests/specs/type-flag.ts Lines 191 to 209 in c2a0aa0
I was thinking |
I think I was actually misinterpreting the Git behavior.
$ git commit --a --m wip
error: ambiguous option: a (could be --allow-empty or --allow-empty-message) I'll actually fix this first so it won't work. |
4d4ec18
to
b581920
Compare
…gle-character-flag
2ae869d
to
6a19b1a
Compare
I think this is basically ready to go. Would you mind tackling the cleye update too? You can install this version of type-flag with: pnpm i 'privatenumber/type-flag#npm/single-character-flag' |
@privatenumber thanks for publishing! I tried to add to cleye but there's a build error: ![]() I haven't had time to dive into it- the generics go very deep... but I suspect this error would appear from the latest If you could publish a version based on latest |
Ok, I was able to repro the above problem on the I used Git bisect result: 5fcb9cc is the first bad commit
6 files changed, 1587 insertions(+), 790 deletions(-) I guess one of the |
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.