You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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 use x and y as aliases, and override documentation to suggest only using plot -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
I'm interested in working on this issue
Compensating engineering work financially will speed up resolution
I'm willing to offer financial support
The text was updated successfully, but these errors were encountered:
The x/y coordinates input are compelling use-cases for supporting this, and I'm happy to brainstorm how we can make this happen.
I think there could be a conflict with type-flag's alias grouping, which is a common practice in many UNIX commands. For example git commit -am 'message' groups flags a and m. I think this functionality might be mutually exclusive with single-character flag names.
EDIT: Or maybe not if we add support for alias-only flags. Thereby supporting your use-case with -x (not --x). Would this work?
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!)
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: