numbers as varying radix values, 15 0xF 0o17 1111 #4564
Labels
A-builder
Area: Builder API
C-enhancement
Category: Raise on the bar on expectations
S-waiting-on-design
Status: Waiting on user-facing design to be resolved before implementing
Discussed in #4563
Originally posted by jtmoon79 December 19, 2022
tl;dr a nice feature for numbers would allow reading passed argument as differing radix among the traditional hexadecimal, decimal, octal, and binary.
I have implemented this here. It's a good bit of work. Would be nice if
clap
handled this for me. I'm imagining an option likeallow_radix_all
And perhaps, further fine-grained options would also be allowed:
allow_radix_hexadecimal
,allow_radix_octal
,allow_radix_binary
. Soallow_radix_all
would just enable all the prior.And might even want to throw in
disallow_radix_decimal
for some users that really want such.Parsing could require a prepended
0
before the radix symbol, e.g.0xF
,0d15
,0o17
,0b1111
and reject without, e.g.xF
,d15
,o17
,b1111
. or could be flexible and accept both. I'm not sure what is best there.The text was updated successfully, but these errors were encountered: