diff options
author | AnotherTest <ali.mpfard@gmail.com> | 2020-06-17 18:51:44 +0430 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2020-07-05 15:43:14 +0200 |
commit | 2915dcfcc314deb4b41efdf14768e527614dc3fc (patch) | |
tree | 2209513d6907cd93bd47231e740d98075b6f7bd2 /Shell/Shell.cpp | |
parent | a4627f24390035a8a8402e019be42b03f525f034 (diff) | |
download | serenity-2915dcfcc314deb4b41efdf14768e527614dc3fc.zip |
Shell: Add the alias builtin and resolve aliases
This follows the other shells in alias resolution, and resolves the
alias only once.
Diffstat (limited to 'Shell/Shell.cpp')
-rw-r--r-- | Shell/Shell.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/Shell/Shell.cpp b/Shell/Shell.cpp index 9ae3b6bc80..b6ce3d8437 100644 --- a/Shell/Shell.cpp +++ b/Shell/Shell.cpp @@ -306,6 +306,11 @@ void Shell::unset_local_variable(const String& name) m_local_variables.remove(name); } +String Shell::resolve_alias(const String& name) const +{ + return m_aliases.get(name).value_or({}); +} + int Shell::run_command(const StringView& cmd) { if (cmd.is_empty()) |