Subject: Re: bug#19849: RFE: du output uses undefined screen-tabsize: expand tabs to spaces or "-T<tabsize> option?"

From: Pádraig Brady <[email-masked]>
Date: Mon, 4 Jan 2016 01:56:32 +0000

tag 19849 notabug
close 19849
stop

On 12/02/15 21:17, Linda Walsh wrote:
> I run a linux compat term that allows setting the tab size.
> Since most of my usage is using tabsize=2, I set the term's
> tabsize to such when it comes up.
> 
> Programs that can display tabs in output like
> 'ls', 'diff', 'less(or more)', to name a few, have some type of
> "expand-tabs" or "-[tT]" option to expand tabs on output
> (or input to line up input columns).
> 
> Ex:
> 
> ls:
>        -T, --tabsize=COLS
>               assume tab stops at each COLS instead of 8
> diff:
>        -t, --expand-tabs
>               expand tabs to spaces in output
>        -T, --initial-tab
>               make tabs line up by prepending a tab
>        --tabsize=NUM
>               tab stops every NUM (default 8) print columns
> (etc..).
> 
> I propose 'du' gain a "-T" option like 'ls' to allow for
> formatted output:
> 
> So instead of :
> 
> 20K My layouts/linda-default.fcl
> 20K My layouts/new-default.fcl
> 0 My layouts/foo.fcl

> I could see:
> 
> 20K     My layouts/linda-default.fcl
> 20K     My layouts/new-default.fcl
> 0       My layouts/foo.fcl

I think of the single tab output by du, as providing
standard separation, with very rough alignment.
One can then adjust alignment easily outside of of du.

For example:

$ du -h | expand
20K     My layouts/linda-default.fcl
20K     My layouts/new-default.fcl
0       My layouts/foo.fcl

Or more sophisticated right alignment and number processing with:

$ du -B1 *.patch | numfmt --format=%6.1f --to=iec
 20.0K My layouts/linda-default.fcl
 20.0K My layouts/new-default.fcl
   0.0 My layouts/foo.fcl

thanks,
Pádraig