aboutsummaryrefslogtreecommitdiffhomepage
path: root/env.h
diff options
context:
space:
mode:
authorGravatar Kevin Ballard <kevin@sb.org>2014-07-12 14:40:46 -0700
committerGravatar Kevin Ballard <kevin@sb.org>2014-07-12 15:35:34 -0700
commitdcc043df3b4d3f2f8aae5d8e8fe50051f78ce848 (patch)
treeec71da325775526d617e946bef394210154176c3 /env.h
parent2457997cd9c624034f28f1be218f93cdc60a3e58 (diff)
Add an optional mode to env_get_string()
The mode restricts the scope in which the variable is searched for. Use this new restricted scope functionality in the `set` builtin. This fixes `set -g` to not show local shadowing variable values, and also allows for scoped erasing of slices.
Diffstat (limited to 'env.h')
-rw-r--r--env.h9
1 files changed, 7 insertions, 2 deletions
diff --git a/env.h b/env.h
index a0931c87..605fc453 100644
--- a/env.h
+++ b/env.h
@@ -169,8 +169,13 @@ public:
};
-/** Gets the variable with the specified name, or env_var_t::missing_var if it does not exist. */
-env_var_t env_get_string(const wcstring &key);
+/**
+ Gets the variable with the specified name, or env_var_t::missing_var if it does not exist.
+
+ \param key The name of the variable to get
+ \param mode An optional scope to search in. All scopes are searched if unset
+*/
+env_var_t env_get_string(const wcstring &key, int mode = 0);
/**
Returns true if the specified key exists. This can't be reliably done