Closed paradox460 closed 4 years ago
You may be unaware, but there are really very short aliases for bool
values. Just 't'
and 'f'
work, for example (or '[yn]'
see --help-syntax
). --no-foo
is actually one character longer than --foo=f
or --foo f
or -f:f
if 'f'
is the short for "foo"
.
Tools I know that do this are not even of the single-dash short/double-dash long variety but more single-dash-long like gcc
. There the amount of typing may be the same, but there is already a more (IMO) jarring syntax departure afoot. There's only so much coherence in the broader CLI universe. I think super short bool values are the best we can/should do here.
Thanks for the brainstorming, though.
There is also some prior discussion about relevant behaviors here: https://github.com/c-blake/cligen/issues/16
A common pattern among some other CLI tools is the use of
-no-
style negation for boolean fields that are default true.Example: git
This would be a nice alternative to having to write
--boolfield=false
I realize that the default syntax has a true field automatically negate, and so in my tools I've adjusted the names accordingly