]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
virsh: update help for "virsh help help"
authorOsier Yang <jyang@redhat.com>
Wed, 1 Dec 2010 12:24:58 +0000 (20:24 +0800)
committerEric Blake <eblake@redhat.com>
Wed, 1 Dec 2010 16:13:11 +0000 (09:13 -0700)
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

index 73d09417dd11f505d0e20306f5b4a9c21539fff2..6a9aba28489bd02eea267c3c62afc89a4a05f271 100644 (file)
@@ -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);