mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-06-05 16:21:15 -03:00
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.
This commit is contained in:
9
env.h
9
env.h
@@ -169,8 +169,13 @@ class env_var_t : public wcstring
|
||||
|
||||
};
|
||||
|
||||
/** 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
|
||||
|
||||
Reference in New Issue
Block a user