coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: RFC: df --output=name to show specified file names


From: Bernhard Voelker
Subject: Re: RFC: df --output=name to show specified file names
Date: Fri, 22 Nov 2013 14:48:05 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.1.0

On 11/22/2013 03:19 AM, Pádraig Brady wrote:
I was looking at disk usage today and found that being able
to output the specified file names in the display would be useful.
Consider the new 'Name' column in:

$ df --o=target,name,pcent /var/*
Mounted on Name          Use%
/          /var/cache     71%
/          /var/lib       71%
/          /var/local     71%
/run       /var/lock       1%
/          /var/log       71%
/run       /var/run        1%
/          /var/spool     71%
/var/tmp   /var/tmp       71%
/          /var/www       71%

The attached implements this.
Worth adding?

Yes, this looks quite useful - and as it comes quite cheap
regarding providing the name in the code I think it's worth
adding.

One caveat is that the Name is '-' if you don't specify any arguments to df,
so therefore if you output all columns by using --output without a parameter,
you'll get a redundant column. I suppose one might suppress this column in that 
case?

I'd leave the "-" column ... "full" output is full output, ;-)
and I always have a strange feeling when a tool misses some
information in "full" output in one case while it outputs
it in the other case.
But I have no strong preference for this. It's up to you.

Now to the patch:

> From 64177cdfedc264d3cb1cc3b94adddd49c8781334 Mon Sep 17 00:00:00 2001
> From: =?UTF-8?q?P=C3=A1draig=20Brady?= <address@hidden>
> Date: Fri, 22 Nov 2013 02:12:34 +0000
> Subject: [PATCH] df: support outputting specified arguments directly
>
> * src/df.c (usage): Document the new 'name' parameter to
> the --output option.

I think this is not a "parameter" - I'd keep the naming for this
thing an "output field", short "field", as it's done in all other
places.

> (get_dev): Add a new parameter to pass the specified
> argument from the command line through.  Use '-' if a
> command line paramater is not being used.

s/paramater/parameter/

> * doc/coreutils.texi (df invocation): Describe the new 'name' parameter.

s/parameter/field/ here likewise.

The rest of the path looks good to me.

What about an extra test ensuring that the output column
really contains the argument names?

  # Ensure that the NAME field contains the argument name.
  cat <<\EOF > exp || framework_failure_
  .
  exp
  EOF

  df --output=name '.' exp >out || fail=1
  sed '1d' out > out2
  compare exp out2 || fail=1

Thanks & have a nice day,
Berny



reply via email to

[Prev in Thread] Current Thread [Next in Thread]