Re: Command-line program to convert 'human' sizes?
From:
Assaf Gordon
Subject:
Re: Command-line program to convert 'human' sizes?
Date:
Tue, 04 Dec 2012 19:56:02 -0500
User-agent:
Mozilla/5.0 (X11; Linux x86_64; rv:10.0.4) Gecko/20120510 Icedove/10.0.4
PƔdraig Brady wrote, On 12/04/2012 07:31 PM:
> On 12/05/2012 12:19 AM, Jim Meyering wrote:
>> PƔdraig Brady wrote:
>>> On 12/04/2012 11:35 PM, Assaf Gordon wrote:
>>>> PƔdraig Brady wrote, On 12/04/2012 06:11 PM:
>>>>> On 12/04/2012 10:55 PM, Assaf Gordon wrote:
>>>>>>> PƔdraig Brady wrote, On 12/04/2012 11:30 AM:
< snip long discussion >
Would the following be acceptable:
1. remove "--to=<NUMBER>" option
2. surplus characters following immediately after converted number trigger a
warning (error?),
except if the following characters match exactly the "suffix" parameter.
Regarding "--format":
The implementation doesn't really use "printf", so "%d" isn't directly usable.
One option is to tell the user to use "%s" (instead of "%d"), and we'll simply
put the result of "human_readable()" as the string parameter in vasnprintf -
this will be flexible in terms of alignment.
Another option is the remove "--format" option, and replace it with "--padding"
or similar.
Regarding grouping (thousands separator):
This only has an effect when no using "--to=SI" or "--to=IEC", right?
Perhaps we can add a separate option "--grouping", and simply turn on the
"human_grouping" flag? (easy to implement).