summaryrefslogtreecommitdiffstats
path: root/cmd-show-environment.c
diff options
context:
space:
mode:
authornicm <nicm>2020-03-31 17:14:40 +0000
committernicm <nicm>2020-03-31 17:14:40 +0000
commitcc8b41f294974cdfb1ddfe3b907da58374ff130f (patch)
tree32855ba0999368039d3d7d40ecbbec3c096c50f9 /cmd-show-environment.c
parente6cddcf752b335cb945bba4619b500b527cfee0a (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 'cmd-show-environment.c')
-rw-r--r--cmd-show-environment.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/cmd-show-environment.c b/cmd-show-environment.c
index eb19cf20..0d2f7dd9 100644
--- a/cmd-show-environment.c
+++ b/cmd-show-environment.c
@@ -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)