From 7bd9cdf6fcf43e0edc8ab3a4accf2009ca5aa35e Mon Sep 17 00:00:00 2001 From: nicm Date: Thu, 21 Oct 2021 08:23:48 +0000 Subject: Show error if user option doesn't exist, GitHub issue 2938. --- cmd-show-options.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'cmd-show-options.c') diff --git a/cmd-show-options.c b/cmd-show-options.c index bdcd3e78..7ac7e455 100644 --- a/cmd-show-options.c +++ b/cmd-show-options.c @@ -127,6 +127,12 @@ cmd_show_options_exec(struct cmd *self, struct cmdq_item *item) parent = 0; if (o != NULL) cmd_show_options_print(self, item, o, idx, parent); + else if (*name == '@') { + if (args_has(args, 'q')) + goto fail; + cmdq_error(item, "invalid option: %s", argument); + goto fail; + } free(name); free(argument); -- cgit From 040164555a0e41d23082b74a2a22ff370e8193c2 Mon Sep 17 00:00:00 2001 From: nicm Date: Mon, 14 Feb 2022 09:10:48 +0000 Subject: Do not return error with -q, GitHub issue 3065. --- cmd-show-options.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'cmd-show-options.c') diff --git a/cmd-show-options.c b/cmd-show-options.c index 7ac7e455..0e7e5192 100644 --- a/cmd-show-options.c +++ b/cmd-show-options.c @@ -103,7 +103,7 @@ cmd_show_options_exec(struct cmd *self, struct cmdq_item *item) name = options_match(argument, &idx, &ambiguous); if (name == NULL) { if (args_has(args, 'q')) - goto fail; + goto out; if (ambiguous) cmdq_error(item, "ambiguous option: %s", argument); else @@ -114,7 +114,7 @@ cmd_show_options_exec(struct cmd *self, struct cmdq_item *item) &cause); if (scope == OPTIONS_TABLE_NONE) { if (args_has(args, 'q')) - goto fail; + goto out; cmdq_error(item, "%s", cause); free(cause); goto fail; @@ -129,11 +129,12 @@ cmd_show_options_exec(struct cmd *self, struct cmdq_item *item) cmd_show_options_print(self, item, o, idx, parent); else if (*name == '@') { if (args_has(args, 'q')) - goto fail; + goto out; cmdq_error(item, "invalid option: %s", argument); goto fail; } +out: free(name); free(argument); return (CMD_RETURN_NORMAL); -- cgit