summaryrefslogtreecommitdiffstats
path: root/cmd-set-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-set-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-set-environment.c')
-rw-r--r--cmd-set-environment.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/cmd-set-environment.c b/cmd-set-environment.c
index a80acd01..248f734a 100644
--- a/cmd-set-environment.c
+++ b/cmd-set-environment.c
@@ -34,8 +34,8 @@ const struct cmd_entry cmd_set_environment_entry = {
.name = "set-environment",
.alias = "setenv",
- .args = { "grt:u", 1, 2 },
- .usage = "[-gru] " CMD_TARGET_SESSION_USAGE " name [value]",
+ .args = { "hgrt:u", 1, 2 },
+ .usage = "[-hgru] " CMD_TARGET_SESSION_USAGE " name [value]",
.target = { 't', CMD_FIND_SESSION, CMD_FIND_CANFAIL },
@@ -96,7 +96,10 @@ cmd_set_environment_exec(struct cmd *self, struct cmdq_item *item)
cmdq_error(item, "no value specified");
return (CMD_RETURN_ERROR);
}
- environ_set(env, name, "%s", value);
+ if (args_has(args, 'h'))
+ environ_set(env, name, ENVIRON_HIDDEN, "%s", value);
+ else
+ environ_set(env, name, 0, "%s", value);
}
return (CMD_RETURN_NORMAL);