linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ilya Dryomov <idryomov@gmail.com>
To: "Hugo Mills" <hugo@carfax.org.uk>,
	"Goffredo Baroncelli" <kreijack@gmail.com>,
	linux-btrfs@vger.kernel.org, "Roman Mamedov" <rm@romanrm.ru>,
	"Sébastien Maury" <sebastien.maury@inserm.fr>,
	"Goffredo Baroncelli" <kreijack@inwind.it>
Subject: Re: [PATCH 1/2] Update btrfs filesystem df command
Date: Wed, 3 Oct 2012 23:43:35 +0300	[thread overview]
Message-ID: <20121003204335.GE2890@zambezi.lan> (raw)
In-Reply-To: <20121003203852.GE25498@carfax.org.uk>

On Wed, Oct 03, 2012 at 09:38:52PM +0100, Hugo Mills wrote:
> On Wed, Oct 03, 2012 at 11:34:00PM +0300, Ilya Dryomov wrote:
> > On Wed, Oct 03, 2012 at 07:22:31PM +0200, Goffredo Baroncelli wrote:
> [snip]
> > > +static const char * const cmd_disk_free_usage[] = {
> > > +	"btrfs filesystem df [-d|-s][-k] <path> [<path>..]",
> > > +	"Show space usage information for a mount point(s).",
> > > +	"",
> > > +	"-k\tSet KB (1024 bytes) as unit",
> > > +	"-s\tShow the summary section only",
> > > +	"-d\tShow the detail section only",
> > > +	NULL
> > > +};
> > > +
> > > +static int cmd_disk_free(int argc, char **argv)
> > > +{
> > > +
> > > +	int 	flags=DF_SHOW_SUMMARY|DF_SHOW_DETAIL|DF_HUMAN_UNIT;
> > > +	int	i, more_than_one=0;
> > > +
> > > +	optind = 1;
> > > +	while(1){
> > > +		char	c = getopt(argc, argv, "dsk");
> > > +		if(c<0)
> > > +			break;
> > > +		switch(c){
> > > +			case 'd':
> > > +				flags &= ~DF_SHOW_SUMMARY;
> > > +				break;
> > > +			case 's':
> > > +				flags &= ~DF_SHOW_DETAIL;
> > > +				break;
> > > +			case 'k':
> > > +				flags &= ~DF_HUMAN_UNIT;
> > > +				break;
> > > +			default:
> > > +				usage(cmd_disk_free_usage);
> > > +		}
> > > +	}
> > > +
> > > +	if( !(flags & (DF_SHOW_SUMMARY|DF_SHOW_DETAIL)) ){
> > > +		fprintf(stderr, "btrfs filesystem df: it is not possible to specify -s AND -d\n");
> > 
> > This doesn't look right at all.  You are adding two switches and
> > specifying both of them is an error?  A little too much for a command
> > whose job is to do some basic math and pretty-print the result.
> > 
> > How about displaying just the summary by default and then adding a
> > *single* switch (-v or whatever) for summary+details?
> 
>    I'd prefer to see both sections by default. The reason for this is
> that without both sections, people tend to get confused because they
> don't know they're looking at half the story (e.g. some numbers change
> twice as fast as they think they should).

If we want both sections by default, there is no need for any switches
whatsoever, I think.

Thanks,

		Ilya

  reply	other threads:[~2012-10-03 20:43 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-03 17:22 [PATCH][BTRFS-PROGS][V2] btrfs filesystem df Goffredo Baroncelli
2012-10-03 17:22 ` [PATCH 1/2] Update btrfs filesystem df command Goffredo Baroncelli
2012-10-03 20:34   ` Ilya Dryomov
2012-10-03 20:38     ` Hugo Mills
2012-10-03 20:43       ` Ilya Dryomov [this message]
2012-10-03 20:53       ` Goffredo Baroncelli
2012-10-03 17:22 ` [PATCH 2/2] Update help page Goffredo Baroncelli
2012-10-03 19:32 ` [PATCH][BTRFS-PROGS][V2] btrfs filesystem df David Sterba
2012-10-03 19:38   ` Goffredo Baroncelli
2012-10-04  7:15     ` David Sterba
  -- strict thread matches above, loose matches on Subject: below --
2012-10-13 19:14 [PATCH][BTRFS-PROGS][V6] " Goffredo Baroncelli
2012-10-13 19:14 ` [PATCH 1/2] Update btrfs filesystem df command Goffredo Baroncelli
2012-10-13 17:47 [PATCH][BTRFS-PROGS][V4] btrfs filesystem df Goffredo Baroncelli
2012-10-13 17:47 ` [PATCH 1/2] Update btrfs filesystem df command Goffredo Baroncelli
2012-10-04 17:27 [PATCH][BTRFS-PROGS][V3] btrfs filesystem df Goffredo Baroncelli
2012-10-04 17:27 ` [PATCH 1/2] Update btrfs filesystem df command Goffredo Baroncelli
2012-10-03 11:43 [PATCH][BTRFS-PROGS][V1] btrfs filesystem df Goffredo Baroncelli
2012-10-03 11:43 ` [PATCH 1/2] Update btrfs filesystem df command Goffredo Baroncelli
2012-10-03 15:02   ` Ilya Dryomov
2012-10-03 16:34     ` Goffredo Baroncelli
2012-10-03 17:20       ` Ilya Dryomov
2012-10-03 17:38         ` Goffredo Baroncelli
2012-10-03 17:09     ` Goffredo Baroncelli

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20121003204335.GE2890@zambezi.lan \
    --to=idryomov@gmail.com \
    --cc=hugo@carfax.org.uk \
    --cc=kreijack@gmail.com \
    --cc=kreijack@inwind.it \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=rm@romanrm.ru \
    --cc=sebastien.maury@inserm.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).