Re: [PATCH 2/6] misc: introduce PRINT_USAGE_HELP()

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

 



On Tue, Jun 27, 2017 at 12:48:44PM +0200, Rüdiger Meier wrote:
> 
> 
> On 06/27/2017 11:46 AM, Karel Zak wrote:
> > On Mon, Jun 26, 2017 at 08:29:48PM +0200, Ruediger Meier wrote:
> > > --- a/include/c.h
> > > +++ b/include/c.h
> > > @@ -315,8 +315,18 @@ static inline int xusleep(useconds_t usec)
> > >   #define USAGE_COMMANDS   _("\nCommands:\n")
> > >   #define USAGE_COLUMNS    _("\nAvailable output columns:\n")
> > >   #define USAGE_SEPARATOR    "\n"
> > > -#define USAGE_HELP       _(" -h, --help     display this help and exit\n")
> > > -#define USAGE_VERSION    _(" -V, --version  output version information and exit\n")
> > > +
> > > +#define USAGE_HELP_TXT    _("display this help and exit")
> > > +#define USAGE_VERSION_TXT _("output version information and exit")
> > > +
> > > +#define PRINT_USAGE_HELP(marg_dsc) \
> > > +	printf( \
> > > +		"%-" #marg_dsc "s%s\n" \
> > > +		"%-" #marg_dsc "s%s\n" \
> > > +		, " -h, --help",    USAGE_HELP_TXT \
> > > +		, " -V, --version", USAGE_VERSION_TXT \
> > > +	)
> > 
> > Would be possible to use lowercase for the macro name?
> > 
> > For example USAGE_HELP_TXT is fine, but for something like function I
> > would prefer
> > 
> >   #define print_usage_help(marg_dsc)
> 
> I've updated on github to

 Cool, merged.

> > and what about USAGE_SEPARATOR that we have always before --help?
> > Maybe we can add \n to  the print_usage_help() too.
> 
> No, because
> 
> 1. There are commands with help options only:
> 
> $ ctrlaltdel --help
>  [...]
>  Options:
>  -h, --help     display this help
>  -V, --version  print version
> 
> 2. Since we have we help descriptions now aligned we do not need
>    the separator always IMO. ipcs(1) and also others which
>    still don't have separators are looking ok:

 I see (I've expected this reply :-).

 Thanks!

    Karel


-- 
 Karel Zak  <kzak@xxxxxxxxxx>
 http://karelzak.blogspot.com
--
To unsubscribe from this list: send the line "unsubscribe util-linux" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux