[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[libvirt] Remove OPTION section in output of 'virsh help command' if no option exists.



Don't print 'OPTION' if there's no options. Just behaves as DESCRIPTION does.
This mostly affects 'interface' command group.

Signed-off-by: Zhang Xiaohe <zhangxh cn fujitsu com>
Reported-by: Li Yang <liyang fnst cn fujitsu com>
---
 tools/virsh.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/tools/virsh.c b/tools/virsh.c
index ecb7bd4..7c60800 100644
--- a/tools/virsh.c
+++ b/tools/virsh.c
@@ -1270,7 +1270,9 @@ vshCmddefHelp(vshControl *ctl, const char *cmdname)

         if (def->opts) {
             const vshCmdOptDef *opt;
-            fputs(_("\n  OPTIONS\n"), stdout);
+            /* Print the option only if there are options */
+            if (def->opts->name)
+                fputs(_("\n  OPTIONS\n"), stdout);
             for (opt = def->opts; opt->name; opt++) {
                 switch (opt->type) {
                 case VSH_OT_BOOL:
--
1.7.1


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]