[Dctrl-tools-devel] Bug#525525: Bug#525525: [PATCH] grep-dctrl: add --compact option

Jeff King peff at peff.net
Thu Nov 3 17:55:20 UTC 2011


On Thu, Nov 03, 2011 at 06:42:36PM +0200, Antti-Juhani Kaijanaho wrote:

> > +                        if (!args.compact || args.num_show_fields > 1)
> 
> Is there any reason to maintain the second clause?  If you're explicitly
> selecting --compact, might you perhaps be interested in a no-separator output
> for a multiple-field case as well?

Yes. I was hoping to never type it, and do:

  alias grep-available='grep-available --compact'

in my shell. :)

If you want to do a "don't ever show the separator", I think it would be
better to make that something like:

  grep-dctrl --separator=''

which is way more flexible (and I don't see any reason that option
couldn't go on top of what I wrote).

> (Also, I can see this option seeing use with scripts too.  See #646189.)

Thanks, I hadn't seen #646189. I hadn't really considered how "-n" would
interact with it. Arguably, --compact is useless, because if you really
want compact output, you would use "-n" anyway (I don't usually, but I
should).

So thinking on it more, I think I'd rather see my patch dropped, and
just have "-n" omit the separator in the single-entry case (i.e., turn
"-n" into a better version of "--compact").

> Otherwise this looks good.  Could you add manpage changes as well?

I'm happy to if you still want --compact, but I'm leaning towards tying
this to "-n" after reading the other bug report.

-Peff





More information about the Dctrl-tools-devel mailing list