diff options
author | Kevin Ballard <kevin@sb.org> | 2014-07-12 14:40:46 -0700 |
---|---|---|
committer | Kevin Ballard <kevin@sb.org> | 2014-07-12 15:35:34 -0700 |
commit | dcc043df3b4d3f2f8aae5d8e8fe50051f78ce848 (patch) | |
tree | ec71da325775526d617e946bef394210154176c3 /env.h | |
parent | 2457997cd9c624034f28f1be218f93cdc60a3e58 (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.h | 9 |
1 files changed, 7 insertions, 2 deletions
@@ -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 |