summaryrefslogtreecommitdiffstats
path: root/cmd-show-options.c
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@openbsd.org>2013-03-25 10:04:04 +0000
committerNicholas Marriott <nicm@openbsd.org>2013-03-25 10:04:04 +0000
commitd39b1a87a5e88444614415398510ff445a0748d6 (patch)
treee7cfa7b6ca73df70c2c1368dd1a8e69d6fabc5d1 /cmd-show-options.c
parent62db3c8efe70020e2555e3f34e8c07d0b2106077 (diff)
Add -q flags to shut up errors to capture-pane and show-options, from
George Nachman.
Diffstat (limited to 'cmd-show-options.c')
-rw-r--r--cmd-show-options.c20
1 files changed, 13 insertions, 7 deletions
diff --git a/cmd-show-options.c b/cmd-show-options.c
index 9b42ed46..57e49a33 100644
--- a/cmd-show-options.c
+++ b/cmd-show-options.c
@@ -30,14 +30,14 @@
enum cmd_retval cmd_show_options_exec(struct cmd *, struct cmd_q *);
enum cmd_retval cmd_show_options_one(struct cmd *, struct cmd_q *,
- struct options *);
+ struct options *, int);
enum cmd_retval cmd_show_options_all(struct cmd *, struct cmd_q *,
const struct options_table_entry *, struct options *);
const struct cmd_entry cmd_show_options_entry = {
"show-options", "show",
- "gst:vw", 0, 1,
- "[-gsvw] [-t target-session|target-window] [option]",
+ "gqst:vw", 0, 1,
+ "[-gqsvw] [-t target-session|target-window] [option]",
0,
NULL,
NULL,
@@ -62,6 +62,7 @@ cmd_show_options_exec(struct cmd *self, struct cmd_q *cmdq)
struct winlink *wl;
const struct options_table_entry *table;
struct options *oo;
+ int quiet;
if (args_has(self->args, 's')) {
oo = &global_options;
@@ -89,15 +90,16 @@ cmd_show_options_exec(struct cmd *self, struct cmd_q *cmdq)
}
}
- if (args->argc != 0)
- return (cmd_show_options_one(self, cmdq, oo));
- else
+ quiet = args_has(self->args, 'q');
+ if (args->argc == 0)
return (cmd_show_options_all(self, cmdq, table, oo));
+ else
+ return (cmd_show_options_one(self, cmdq, oo, quiet));
}
enum cmd_retval
cmd_show_options_one(struct cmd *self, struct cmd_q *cmdq,
- struct options *oo)
+ struct options *oo, int quiet)
{
struct args *args = self->args;
const struct options_table_entry *table, *oe;
@@ -106,6 +108,8 @@ cmd_show_options_one(struct cmd *self, struct cmd_q *cmdq,
if (*args->argv[0] == '@') {
if ((o = options_find1(oo, args->argv[0])) == NULL) {
+ if (quiet)
+ return (CMD_RETURN_NORMAL);
cmdq_error(cmdq, "unknown option: %s", args->argv[0]);
return (CMD_RETURN_ERROR);
}
@@ -122,6 +126,8 @@ cmd_show_options_one(struct cmd *self, struct cmd_q *cmdq,
return (CMD_RETURN_ERROR);
}
if (oe == NULL) {
+ if (quiet)
+ return (CMD_RETURN_NORMAL);
cmdq_error(cmdq, "unknown option: %s", args->argv[0]);
return (CMD_RETURN_ERROR);
}