[PATCH 3/5]virsh: if VSH_OFLAG_IGNORE set, don't show it in '--help'

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

 



From: Chen Hanxiao <chenhanxiao@xxxxxxxxxxxxxx>

If VSH_OFLAG_IGNORE set, don't show it in '--help'.

Signed-off-by: Chen Hanxiao <chenhanxiao@xxxxxxxxxxxxxx>
---
 tools/virsh.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/tools/virsh.c b/tools/virsh.c
index 6842ed8..f772794 100644
--- a/tools/virsh.c
+++ b/tools/virsh.c
@@ -1004,6 +1004,8 @@ vshCmddefOptParse(const vshCmdDef *cmd, uint32_t *opts_need_arg,
 
         if (i > 31)
             return -1; /* too many options */
+        if (opt->flags & VSH_OFLAG_IGNORE)
+            continue;
         if (opt->type == VSH_OT_BOOL) {
             if (opt->flags & VSH_OFLAG_REQ)
                 return -1; /* bool options can't be mandatory */
@@ -1213,6 +1215,8 @@ vshCmddefHelp(vshControl *ctl, const char *cmdname)
         if (def->opts) {
             const vshCmdOptDef *opt;
             for (opt = def->opts; opt->name; opt++) {
+                if (opt->flags & VSH_OFLAG_IGNORE)
+                    continue;
                 const char *fmt = "%s";
                 switch (opt->type) {
                 case VSH_OT_BOOL:
@@ -1267,6 +1271,8 @@ vshCmddefHelp(vshControl *ctl, const char *cmdname)
             const vshCmdOptDef *opt;
             fputs(_("\n  OPTIONS\n"), stdout);
             for (opt = def->opts; opt->name; opt++) {
+                if (opt->flags & VSH_OFLAG_IGNORE)
+                    continue;
                 switch (opt->type) {
                 case VSH_OT_BOOL:
                     snprintf(buf, sizeof(buf), "--%s", opt->name);
-- 
1.8.2.1

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]