diff options
author | Nicholas Marriott <nicm@cvs.openbsd.org> | 2020-03-31 17:14:42 +0000 |
---|---|---|
committer | Nicholas Marriott <nicm@cvs.openbsd.org> | 2020-03-31 17:14:42 +0000 |
commit | 39d0bc77f0ce2c66e52d5bd6228b4ba6543b1c91 (patch) | |
tree | 7a61dcd8012ede9d2759b110a4c755e44456b357 /usr.bin/tmux/cmd-show-environment.c | |
parent | a50cb7ffe73f1e00829305a3b87bced6370b8e48 (diff) |
Add a way to mark environment variables as "hidden" so they can be used
by tmux but are not passed into the environment of new panes.
Diffstat (limited to 'usr.bin/tmux/cmd-show-environment.c')
-rw-r--r-- | usr.bin/tmux/cmd-show-environment.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/usr.bin/tmux/cmd-show-environment.c b/usr.bin/tmux/cmd-show-environment.c index 50a53c946e6..76001467e93 100644 --- a/usr.bin/tmux/cmd-show-environment.c +++ b/usr.bin/tmux/cmd-show-environment.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-show-environment.c,v 1.23 2017/04/22 10:22:39 nicm Exp $ */ +/* $OpenBSD: cmd-show-environment.c,v 1.24 2020/03/31 17:14:40 nicm Exp $ */ /* * Copyright (c) 2009 Nicholas Marriott <nicholas.marriott@gmail.com> @@ -38,8 +38,8 @@ const struct cmd_entry cmd_show_environment_entry = { .name = "show-environment", .alias = "showenv", - .args = { "gst:", 0, 1 }, - .usage = "[-gs] " CMD_TARGET_SESSION_USAGE " [name]", + .args = { "hgst:", 0, 1 }, + .usage = "[-hgs] " CMD_TARGET_SESSION_USAGE " [name]", .target = { 't', CMD_FIND_SESSION, CMD_FIND_CANFAIL }, @@ -69,7 +69,13 @@ static void cmd_show_environment_print(struct cmd *self, struct cmdq_item *item, struct environ_entry *envent) { - char *escaped; + struct args *args = self->args; + char *escaped; + + if (!args_has(args, 'h') && (envent->flags & ENVIRON_HIDDEN)) + return; + if (args_has(args, 'h') && (~envent->flags & ENVIRON_HIDDEN)) + return; if (!args_has(self->args, 's')) { if (envent->value != NULL) |