-
-
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
Support single-character flags #26
Comments
Thanks for your sponsorship! The I think there could be a conflict with type-flag's alias grouping, which is a common practice in many UNIX commands. For example EDIT: Or maybe not if we add support for alias-only flags. Thereby supporting your use-case with |
I think that would work, yes. It'd probably be how most users would guess a cli should be used too. It kinda forces a particular usage but that's ok because it's a more convenient usage. It'd be good enough for trpc-cli I think - a use case I wanted to cover was just throwing pretty much any trpc router at it and getting a functional CLI. That broke down for single-letter input props but a change like you suggest would cover them. (V welcome re sponsorship. Thank you for your libraries - I am using more and more I find!) |
I marked this as "pr welcome". I'm not able to make time for this at the moment but feel free to tackle it if you'd like. |
Feature request
It would be good to be able to define a flag that's only one character.
Motivations
I came across it while implementing trpc-cli, which uses
cleye
under the hood.There are valid use cases for for single-character flags that aren't abbreviations, like
plot --x 1 --y 2
Alternatives
Of course it will usually be possible to do awkward workarounds like
plot --xx 1 --yy 2
, and usex
andy
as aliases, and override documentation to suggest only usingplot -x 1 -y 2
, but this is cumbersome.Additional context
I imagine the restriction is because it muddies the water a bit with aliases (would be confusing to have
--x
mean one thing, but-x
be an alias for something else). If that's the reason for the restriction, maybe there could be a check added to make sure the alias exactly matches the "long" form.Bugs are expected to be fixed by those affected by it
Compensating engineering work financially will speed up resolution
The text was updated successfully, but these errors were encountered: