[libvirt] [PATCH] virsh: update help for "virsh help help"

As virsh help supports both command and command group now, update "cmdHelp" to print consite help, (this patch is increment of "7829052757953023b0826e0293ffe18ed4ab89e9"). And also remove redundant empty line in "vshUsage". * tools/virsh.c --- tools/virsh.c | 19 +++++++++++++------ 1 files changed, 13 insertions(+), 6 deletions(-) diff --git a/tools/virsh.c b/tools/virsh.c index 010e345..6a9aba2 100644 --- a/tools/virsh.c +++ b/tools/virsh.c @@ -562,13 +562,15 @@ vshReconnect(vshControl *ctl) { */ static const vshCmdInfo info_help[] = { {"help", N_("print help")}, - {"desc", N_("Prints global help or command specific help.")}, + {"desc", N_("Prints global help, command specific help, or help for a\n" + " group of related commands")}, {NULL, NULL} }; static const vshCmdOptDef opts_help[] = { - {"command", VSH_OT_DATA, 0, N_("name of command")}, + {"command", VSH_OT_DATA, 0, N_("Prints global help or command specific help.")}, + {"group", VSH_OT_DATA, 0, N_("Prints global help or help for a group of related commands.")}, {NULL, 0, 0, NULL} }; @@ -577,7 +579,12 @@ cmdHelp(vshControl *ctl, const vshCmd *cmd) { const vshCmdDef *c; const vshCmdGrp *g; - const char *name = vshCommandOptString(cmd, "command", NULL); + const char *name; + + name = vshCommandOptString(cmd, "command", NULL); + + if (!name) + name = vshCommandOptString(cmd, "group", NULL); if (!name) { const vshCmdGrp *grp; @@ -596,8 +603,8 @@ cmdHelp(vshControl *ctl, const vshCmd *cmd) vshPrint(ctl, "\n"); } - return TRUE; - } + return TRUE; + } if ((c = vshCmddefSearch(name))) { return vshCmddefHelp(ctl, name); @@ -11694,7 +11701,7 @@ vshUsage(void) " -q | --quiet quiet mode\n" " -t | --timing print timing information\n" " -l | --log <file> output logging to file\n" - " -v | --version[=short] program version\n\n" + " -v | --version[=short] program version\n" " -V | --version=long version and full options\n\n" " commands (non interactive mode):\n\n"), progname, progname); -- 1.7.3.2

On 01/12/2010, at 11:24 PM, Osier Yang wrote:
As virsh help supports both command and command group now, update "cmdHelp" to print consite help, (this patch is increment of "7829052757953023b0826e0293ffe18ed4ab89e9").
And also remove redundant empty line in "vshUsage".
* tools/virsh.c --- tools/virsh.c | 19 +++++++++++++------ 1 files changed, 13 insertions(+), 6 deletions(-)
ACK for this, but you'll need to drop the fix for the extra carriage return in the --help output.

On 12/01/2010 09:04 AM, Justin Clift wrote:
On 01/12/2010, at 11:24 PM, Osier Yang wrote:
As virsh help supports both command and command group now, update "cmdHelp" to print consite help, (this patch is increment of "7829052757953023b0826e0293ffe18ed4ab89e9").
And also remove redundant empty line in "vshUsage".
* tools/virsh.c --- tools/virsh.c | 19 +++++++++++++------ 1 files changed, 13 insertions(+), 6 deletions(-)
ACK for this, but you'll need to drop the fix for the extra carriage return in the --help output.
That resolved automatically by 'git am -3', so I've pushed the resulting modified patch. -- Eric Blake eblake@redhat.com +1-801-349-2682 Libvirt virtualization library http://libvirt.org
participants (3)
-
Eric Blake
-
Justin Clift
-
Osier Yang