From: Chen Hanxiao <chenhanxiao(a)cn.fujitsu.com>
If VSH_OFLAG_IGNORE set, don't show it in '--help'.
Signed-off-by: Chen Hanxiao <chenhanxiao(a)cn.fujitsu.com>
---
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