mirror of
https://github.com/fish-shell/fish-shell.git
synced 2025-03-15 15:05:27 +08:00
expand_abbreviation to always accept an environment_t
Now that snapshotting is fixed, we don't need to get the principal environment stack any more.
This commit is contained in:
parent
2e119813e1
commit
a173c079d5
@ -1191,12 +1191,6 @@ maybe_t<wcstring> expand_abbreviation(const wcstring &src, const environment_t &
|
||||
return none();
|
||||
}
|
||||
|
||||
maybe_t<wcstring> expand_abbreviation(const wcstring &src) {
|
||||
// FIXME: We use the principal environment stack because we don't know which variables need to
|
||||
// be captured in a snapshot.
|
||||
return expand_abbreviation(src, env_stack_t::principal());
|
||||
}
|
||||
|
||||
std::map<wcstring, wcstring> get_abbreviations(const environment_t &vars) {
|
||||
// TODO: try to make this cheaper
|
||||
const size_t fish_abbr_len = std::wcslen(L"_fish_abbr_");
|
||||
|
@ -162,7 +162,6 @@ wcstring replace_home_directory_with_tilde(const wcstring &str, const environmen
|
||||
/// Abbreviation support. Expand src as an abbreviation, returning the expanded form if found,
|
||||
/// none() if not.
|
||||
maybe_t<wcstring> expand_abbreviation(const wcstring &src, const environment_t &vars);
|
||||
maybe_t<wcstring> expand_abbreviation(const wcstring &src);
|
||||
|
||||
/// \return a snapshot of all abbreviations as a map abbreviation->expansion.
|
||||
std::map<wcstring, wcstring> get_abbreviations(const environment_t &vars);
|
||||
|
@ -1100,7 +1100,7 @@ static bool command_is_valid(const wcstring &cmd, enum parse_statement_decoratio
|
||||
if (!is_valid && function_ok) is_valid = function_exists_no_autoload(cmd, vars);
|
||||
|
||||
// Abbreviations
|
||||
if (!is_valid && abbreviation_ok) is_valid = expand_abbreviation(cmd).has_value();
|
||||
if (!is_valid && abbreviation_ok) is_valid = expand_abbreviation(cmd, vars).has_value();
|
||||
|
||||
// Regular commands
|
||||
if (!is_valid && command_ok) is_valid = path_get_path(cmd, NULL, vars);
|
||||
|
Loading…
x
Reference in New Issue
Block a user