[lttng-dev] [PATCH] Improve lttng-tools lttng.c usage()

Thibault, Daniel Daniel.Thibault at drdc-rddc.gc.ca
Wed Jan 25 14:53:06 EST 2012


------------------------------
Message: 6
Date: Wed, 25 Jan 2012 14:19:34 -0500
From: Mathieu Desnoyers <compudj at krystal.dyndns.org>
Subject: Re: [lttng-dev] [PATCH] Improve lttng-tools lttng.c usage()
Message-ID: <20120125191934.GC10043 at Krystal>

> > -	fprintf(ofp, "  -h, --help             Show this help\n");
> > +	fprintf(ofp, "  -h, --help             Show this help and exit\n");
>
> "and exit" -> useless to specify this in the help, implicit to showing help.

   Can't hurt to mention it, though?

> > +	fprintf(ofp, "      --list-options     List the available lttng options and exit\n");
> > +	fprintf(ofp, "      --list-commands    List the available lttng commands and exit\n");
>
> --list* are only for bash completion. not sure it's useful to have them
> at the top. "and exit" is useless here too imho.

   I found the --list-* options handy when first familiarising myself with lttng 2; on the other hand, it's true that now that we have bash-completion they won't see as much direct use.

> > +	fprintf(ofp, "  -v, --verbose          Verbose mode (may be repeated up to 3 times\n");
> > +	fprintf(ofp, "                         for increased verbosity)\n");
>
> please give an example, e.g. "-vvv"

   Like so?
+	fprintf(ofp, "                         for increased verbosity; e.g. -vvv)\n");

> >  	fprintf(ofp, "  -n, --no-sessiond      Don't spawn a session daemon\n");
> > -	fprintf(ofp, "      --sessiond-path    Session daemon full path\n");
> > -	fprintf(ofp, "      --list-options     Simple listing of lttng options\n");
> > -	fprintf(ofp, "      --list-commands    Simple listing of lttng commands\n");
> > +	fprintf(ofp, "  --sessiond-path PATH   Session daemon full path\n");
>
> incorrect indentation of the help text.

   That last line needed the 'PATH' added; by dedenting it I avoided having to move the description tab stop to the right.  Here's a patch that fixes the indentations (and adds the -vvv example):

------------------------------
>From aed108e63ba227fecf1e97526a1ec8ed38612913 Wed, 25 Jan 2012 14:51:26 -0500
From: Daniel U. Thibault <daniel.thibault at drdc-rddc.gc.ca>
Date: Wed, 25 Jan 2012 14:51:14 -0500
Subject: [PATCH] Widen usage() indentation to accommodate --sessiond-path PATH, add -vvv example

diff --git a/src/bin/lttng/lttng.c b/src/bin/lttng/lttng.c
index 4ffabee..13e8fee 100644
--- a/src/bin/lttng/lttng.c
+++ b/src/bin/lttng/lttng.c
@@ -85,15 +85,15 @@
 	fprintf(ofp, "usage: lttng [options] <command>\n");
 	fprintf(ofp, "\n");
 	fprintf(ofp, "Options:\n");
-	fprintf(ofp, "  -h, --help             Show this help and exit\n");
-	fprintf(ofp, "      --list-options     List the available lttng options and exit\n");
-	fprintf(ofp, "      --list-commands    List the available lttng commands and exit\n");
-	fprintf(ofp, "  -v, --verbose          Verbose mode (may be repeated up to 3 times\n");
-	fprintf(ofp, "                         for increased verbosity)\n");
-	fprintf(ofp, "  -q, --quiet            Quiet mode\n");
-	fprintf(ofp, "  -g, --group NAME       Unix tracing group name. (default: tracing)\n");
-	fprintf(ofp, "  -n, --no-sessiond      Don't spawn a session daemon\n");
-	fprintf(ofp, "  --sessiond-path PATH   Session daemon full path\n");
+	fprintf(ofp, "  -h, --help                Show this help and exit\n");
+	fprintf(ofp, "      --list-options        List the available lttng options and exit\n");
+	fprintf(ofp, "      --list-commands       List the available lttng commands and exit\n");
+	fprintf(ofp, "  -v, --verbose             Verbose mode (may be repeated up to 3 times\n");
+	fprintf(ofp, "                            for increased verbosity; e.g. -vvv)\n");
+	fprintf(ofp, "  -q, --quiet               Quiet mode\n");
+	fprintf(ofp, "  -g, --group NAME          Unix tracing group name. (default: tracing)\n");
+	fprintf(ofp, "  -n, --no-sessiond         Don't spawn a session daemon\n");
+	fprintf(ofp, "      --sessiond-path PATH  Session daemon full path\n");
 	fprintf(ofp, "\n");
 	fprintf(ofp, "Commands:\n");
 	fprintf(ofp, "    add-context     Add context to event and/or channel\n");
------------------------------

Daniel U. Thibault
R & D pour la défense Canada - Valcartier (RDDC Valcartier) / Defence R&D Canada - Valcartier (DRDC Valcartier)
Système de systèmes (SdS) / System of Systems (SoS)
Solutions informatiques et expérimentations (SIE) / Computing Solutions and Experimentations (CSE)
2459 Boul. Pie XI Nord
Québec, QC  G3J 1X5
CANADA
Vox : (418) 844-4000 x4245
Fax : (418) 844-4538
NAC: 918V QSDJ
Gouvernement du Canada / Government of Canada
<http://www.valcartier.drdc-rddc.gc.ca/>



More information about the lttng-dev mailing list