aboutsummaryrefslogtreecommitdiff
path: root/main.c
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2016-03-27 23:53:50 -0400
committerMike Frysinger <vapier@gentoo.org>2016-03-27 23:53:50 -0400
commitd81fc0710ae12ce026053163370ab3dac5c1b1a5 (patch)
treeb1b911eb493bb6f8f5356a3d3d0562288a1a4efb /main.c
parentqlop: add --date option to filter output (diff)
downloadportage-utils-d81fc0710ae12ce026053163370ab3dac5c1b1a5.tar.gz
portage-utils-d81fc0710ae12ce026053163370ab3dac5c1b1a5.tar.bz2
portage-utils-d81fc0710ae12ce026053163370ab3dac5c1b1a5.zip
usage: add an extended text sectionv0.63
Many applets now are so complicated that a single line of text isn't sufficient to describe all of its capabilities/nuances. Allow them to pass in an arbitrary string of data to contain examples.
Diffstat (limited to 'main.c')
-rw-r--r--main.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/main.c b/main.c
index 08347567..a50b451b 100644
--- a/main.c
+++ b/main.c
@@ -115,7 +115,7 @@ void no_colors(void)
/* display usage and exit */
static void usage(int status, const char *flags, struct option const opts[],
- const char * const help[], int blabber)
+ const char * const help[], const char *desc, int blabber)
{
const char opt_arg[] = "[arg]";
const char a_arg[] = "<arg>";
@@ -136,10 +136,13 @@ static void usage(int status, const char *flags, struct option const opts[],
DKBLUE, applets[i].opts, NORM,
RED, NORM, _(applets[i].desc));
} else if (blabber > 0) {
- printf("%sUsage:%s %s%s%s <opts> %s%s%s %s:%s %s\n", GREEN, NORM,
- YELLOW, applets[blabber].name, NORM,
- DKBLUE, applets[blabber].opts, NORM,
- RED, NORM, _(applets[blabber].desc));
+ printf("%sUsage:%s %s%s%s [opts] %s%s%s %s:%s %s\n",
+ GREEN, NORM,
+ YELLOW, applets[blabber].name, NORM,
+ DKBLUE, applets[blabber].opts, NORM,
+ RED, NORM, _(applets[blabber].desc));
+ if (desc)
+ printf("\n%s\n", desc);
}
if (module_name != NULL)
printf("%sLoaded module:%s\n%s%8s%s %s<args>%s\n", GREEN, NORM, YELLOW, module_name, NORM, DKBLUE, NORM);