From b0ba1ed0a8d0d8fcaf26913efdd9e8072c00eb3a Mon Sep 17 00:00:00 2001 From: Jakob Hellermann <jakob.hellermann@protonmail.com> Date: Thu, 1 Aug 2019 15:36:55 +0200 Subject: [PATCH] feat: allow use of empty 'alias' (print if exists) --- src/lib/builtins/variables.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/lib/builtins/variables.rs b/src/lib/builtins/variables.rs index 43e441a2..7cdcb1e6 100644 --- a/src/lib/builtins/variables.rs +++ b/src/lib/builtins/variables.rs @@ -75,7 +75,11 @@ pub fn builtin_alias(args: &[types::Str], shell: &mut Shell<'_>) -> Status { } Binding::ListEntries => print_list(shell.variables()), Binding::KeyOnly(key) => { - return Status::error(format!("ion: please provide value for alias '{}'", key)); + if let Some(alias) = shell.variables().get(&key) { + println!("alias {}='{}'", key, alias); + } else { + return Status::error(format!("ion: alias '{}' not found", key)); + } } } Status::SUCCESS -- GitLab