bug#10915: 8.13: df -- overly long output lines are very hard to read

2012-07-27 Thread Bernhard Voelker
On 07/26/2012 06:11 PM, Pádraig Brady wrote:
> On 07/26/2012 04:43 PM, Bernhard Voelker wrote:
>> On 07/26/2012 04:23 PM, Pádraig Brady wrote:

>>> So a full --output list supported by df could be
>>> FSTYPE,SOURCE,TARGET,SIZE,USED,AVAIL,FREEPCT

Today, there's no FREEPCT, but USEDPCT.
I'd leave that.


> Oh right the last 4 items above should also have I... variants
> to cater for inodes.

What about ISIZE, IUSED, IAVAIL and IUSEDPCT?


>> We could for the first time have blocks and inodes statistics
>> in one command:
> 
> Good point, but that could be allowed too with --output

Right.

>> And some directives could have mixed SIZE modifiers, e.g.
>>
>>   %{SIZE}u   used blocks with SIZE like KMGTPEZY.
>>   %{SIZE}i  inode number
>>
>>   df --format="%Tt %Gu %Ki %m"
> 
> T overlaps, but I see what you mean.

The SIZE could be in {}, e.g. "%{T}t".

How could we do this with --ouput?
Maybe something like:

  df --output=SIZE/M,IFREE/K,USED/1024,TARGET

> Would you still want to apply mbsalign to all fields
> but the last when using a specific format like this?

No, the idea was to create format specifiers for that like
e.g. "%-FIELD" (left-aligned) and "%+FIELD" (right-aligned),
and to have the traditional formats be a certain combination
of it.

This would need a lot of checking ... e.g. if a format string
contained a '+' or a '-', then what should happen with the
other fields? Error? Default alignment per field? Centered?
... --format is more flexible and much more complex.

> 60:40 for --output as ordering/selection is needed by some
> 40:60 against --printf as detailed formatting is neede by few

You see, I'm still jumping between --output and --format, now
also 60:40 pro --output.

What do the others think?

Have a nice day,
Berny





bug#10915: 8.13: df -- overly long output lines are very hard to read

2012-07-27 Thread Pádraig Brady
On 07/27/2012 08:00 AM, Bernhard Voelker wrote:
> On 07/26/2012 06:11 PM, Pádraig Brady wrote:
>> On 07/26/2012 04:43 PM, Bernhard Voelker wrote:
>>> On 07/26/2012 04:23 PM, Pádraig Brady wrote:
> 
 So a full --output list supported by df could be
 FSTYPE,SOURCE,TARGET,SIZE,USED,AVAIL,FREEPCT
> 
> Today, there's no FREEPCT, but USEDPCT.
> I'd leave that.

Oops, right :)

>> Oh right the last 4 items above should also have I... variants
>> to cater for inodes.
> 
> What about ISIZE, IUSED, IAVAIL and IUSEDPCT?

Yes, that's what I was thinking.

>>> We could for the first time have blocks and inodes statistics
>>> in one command:
>>
>> Good point, but that could be allowed too with --output
> 
> Right.
> 
>>> And some directives could have mixed SIZE modifiers, e.g.
>>>
>>>   %{SIZE}u  used blocks with SIZE like KMGTPEZY.
>>>   %{SIZE}i  inode number
>>>
>>>   df --format="%Tt %Gu %Ki %m"
>>
>> T overlaps, but I see what you mean.
> 
> The SIZE could be in {}, e.g. "%{T}t".
> 
> How could we do this with --ouput?
> Maybe something like:
> 
>   df --output=SIZE/M,IFREE/K,USED/1024,TARGET

Too much control I think.
Probably best leave the units globally controlled by -B and -h.

> 
>> Would you still want to apply mbsalign to all fields
>> but the last when using a specific format like this?
> 
> No, the idea was to create format specifiers for that like
> e.g. "%-FIELD" (left-aligned) and "%+FIELD" (right-aligned),
> and to have the traditional formats be a certain combination
> of it.
> 
> This would need a lot of checking ... e.g. if a format string
> contained a '+' or a '-', then what should happen with the
> other fields? Error? Default alignment per field? Centered?
> ... --format is more flexible and much more complex.

>> 60:40 for --output as ordering/selection is needed by some
>> 40:60 against --printf as detailed formatting is needed by few
> 
> You see, I'm still jumping between --output and --format, now
> also 60:40 pro --output.

Marginal decisions like this are awkward.
Thanks for taking the time to present possible options.

> 
> What do the others think?
> 
> Have a nice day,
> Berny
> 

cheers,
Pádraig.





bug#10915: 8.13: df -- overly long output lines are very hard to read

2012-07-27 Thread Jim Meyering
Pádraig Brady wrote:
...
>>   df --printf="%U\0%s\0%m\0\n"
>>
>> As already said, this would be a greater change in df.c,
>> but some code could surely be shared with stat.c and maybe
>> in future with "ls --format=..." ;-)
>>
>> I'm not against --output, but the advantage of a more
>> flexible --printf is unbeatable IMO.
>
> 60:40 for --output as ordering/selection is needed by some
> 40:60 against --printf as detailed formatting is neede by few

At first I was going to say I'm 50:50,
but as I wrote, the balance tipped in favor of --output,
maybe even to 70:30.

A big factor for me was that here we want a column-selecting
option, rather than a true printf-like format-specifying option.
Of course we could augment the format-specifying option with
semantics that delimit columns and that allow us to specify
alternate formatting/units per column, but that would be something
new.  The simpler column-selecting facility (like that of say, ps)
seems attractive.

While added flexibility of --printf=FMT would be nice, it seems like it
would come at a price (more code and more complexity), and as Pádraig
says, in df the feature might not be used enough to justify the expense.
A point in --printf's favor is consistency with stat's option name and
the someday-in-ls option name.  I prefer --printf over --format because
in stat, --format always evokes a trailing newline.

However, it is hard to judge without seeing the actual changes.
If you feel strongly about it, go ahead and implement your preference.
Maybe the resulting code will be small and clean enough that the added
flexibility will be an obvious net gain.





bug#10915: 8.13: df -- overly long output lines are very hard to read

2012-07-27 Thread Bernhard Voelker
On 07/27/2012 02:04 PM, Jim Meyering wrote:
> However, it is hard to judge without seeing the actual changes.
> If you feel strongly about it, go ahead and implement your preference.
> Maybe the resulting code will be small and clean enough that the added
> flexibility will be an obvious net gain.

I'll try ... but it will take some time.
Thanks.

Have a nice day,
Berny