[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: numfmt (=print 'human' sizes) updates
From: |
Pádraig Brady |
Subject: |
Re: numfmt (=print 'human' sizes) updates |
Date: |
Sat, 22 Dec 2012 02:07:13 +0000 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:13.0) Gecko/20120615 Thunderbird/13.0.1 |
On 12/22/2012 12:51 AM, Assaf Gordon wrote:
Hello Pádraig,
Thanks for the review and the feedback.
Pádraig Brady wrote, On 12/21/2012 12:42 PM:
It's looking like a really useful cohesive command.
The attached patch addresses the following issues:
1. changed the "---devdebug" option
2. incorporated most of 'indent -nut' recommendations.
3. improved the usage string, to generate somewhat better man page.
(help2man is a bit finicky about formatting, so it's not optimal).
Yes it's awkward to work around the help2man constraints.
4. "i" suffix with "iec" input/output:
I understand the reason for always adding "i", as it is The Right Thing to do.
But I think some (most?) people still treat single-letter suffix (K/M/G/T/etc.) as a
valid suffix for both SI and IEC, and deduce the scale from the context of whatever
they're working on. Forcing them to use "Ki" might be too obtrusive.
It could also mess-up automated scripted, when IEC scale is needed, but only
with single-letter suffix (and there are many programs like that).
As a compromise, I've added yet another scale option: "ieci" .
When used with "--from=ieci", a two-letter suffix is required.
When used with "--to=ieci", "i" will always be appended.
Examples:
====
$ ./src/numfmt --to=iec 4096
4.0K
$ ./src/numfmt --to=ieci 4096
4.0Ki
$ ./src/numfmt --from=iec 4K
4096
$ ./src/numfmt --from=ieci 4Ki
4096
$ ./src/numfmt --from=auto 4Ki
4096
$ ./src/numfmt --from=auto 4K
4000
# 'ieci' requires the 'i':
$ ./src/numfmt --from=ieci 4K
./src/numfmt: missing 'i' suffix in input: '4K' (e.g Ki/Mi/Gi)
# 'iec' does not accept 'i':
$ ./src/numfmt --from=iec 4Ki
./src/numfmt: invalid suffix in input '4Ki': 'i'
====
I hope this cover all the options, while maintaining consistent and expected
behavior.
(Optionally, we can change "iec" to behave like "ieci", and rename "ieci" to
something else).
I like the 'ieci' compromise.
Also because it has two 'i's in it, there will be
less confusion as to which is which between 'si' and 'ieci'.
I suppose an alternative to 'ieci' is 'ibi', but I slightly
prefer your 'ieci'.
I will send "--format" and error message updates soon.
thanks!
Pádraig.
- numfmt (=print 'human' sizes) updates, Assaf Gordon, 2012/12/13
- Re: numfmt (=print 'human' sizes) updates, Assaf Gordon, 2012/12/14
- Re: numfmt (=print 'human' sizes) updates, Pádraig Brady, 2012/12/14
- Re: numfmt (=print 'human' sizes) updates, Eric Blake, 2012/12/14
- Re: numfmt (=print 'human' sizes) updates, Assaf Gordon, 2012/12/18
- Re: numfmt (=print 'human' sizes) updates, Pádraig Brady, 2012/12/21
- Re: numfmt (=print 'human' sizes) updates, Assaf Gordon, 2012/12/21
- Re: numfmt (=print 'human' sizes) updates,
Pádraig Brady <=
- Re: numfmt (=print 'human' sizes) updates, Eric Blake, 2012/12/21
- Re: numfmt (=print 'human' sizes) updates, Pádraig Brady, 2012/12/21
- Re: numfmt (=print 'human' sizes) updates, Assaf Gordon, 2012/12/26
- Re: numfmt (=print 'human' sizes) updates, Pádraig Brady, 2012/12/26
- Re: numfmt (=print 'human' sizes) updates, Assaf Gordon, 2012/12/26
- Re: numfmt (=print 'human' sizes) updates, Assaf Gordon, 2012/12/27