I assumed "usage" is printed in response to a failure to give the correct combination of command and argument and that -h (or help) would give more detail. I would like the usage (response to incorrect combination) to be the "synopsis" while the grouped commands and their valid arguments is supplied for -h. Reason being failure to give the correct format is most likely a typo anyway, while, if an infrequent user, you might need to check (eg) that download takes a directory, while init-system takes a file and dump takes nothing. (I can never remember whether it is init-system or system-init, as I do it about once a year). For anything more complex, there is "man". Would two columns be a solution for those who struggle with scroll back?
On Tue, 2 Jul 2019 at 21:23, Klemens Nanni <[email protected]> wrote: > Thanks for the input; I won't persue such verbose usages any longer. > > Another attempt was to continue grouping the commands by their arguments: > > $ ldomctl -h > usage: ldomctl command [argument ...] > ldomctl delete|select configuration > ldomctl download directory > ldomctl dump > ldomctl list > ldomctl init-system file > ldomctl panic|start|status|stop [domain] > > But this still seems long enough and even harder to read, so the > following patch simply cuts it to the synopsis as per the manual: > > $ ldomctl -h > usage: ldomctl command [argument ...] > > It contains less information than before, but is actually consistent > and not incomplete any longer, which bothers me with the current usage. > > Feedback? Obections? OK? > > Index: ldomctl.c > =================================================================== > RCS file: /cvs/src/usr.sbin/ldomctl/ldomctl.c,v > retrieving revision 1.21 > diff -u -p -r1.21 ldomctl.c > --- ldomctl.c 15 Sep 2018 13:20:16 -0000 1.21 > +++ ldomctl.c 1 Jul 2019 19:45:59 -0000 > @@ -157,10 +157,7 @@ main(int argc, char **argv) > void > usage(void) > { > - extern char *__progname; > - > - fprintf(stderr, "usage: %s start|stop|panic domain\n", __progname); > - fprintf(stderr, " %s status [domain]\n", __progname); > + fprintf(stderr, "usage: %s command [argument ...]\n", > getprogname()); > exit(EXIT_FAILURE); > } > > >
