From 12336713a08799d359b7358f84d48571f4dde90b Mon Sep 17 00:00:00 2001 From: Lazarus Lazaridis Date: Mon, 12 Mar 2018 06:45:19 +0200 Subject: [PATCH] Move duplicate warning before registration message. --- goto.bash | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/goto.bash b/goto.bash index a3a28e5..8b08d44 100644 --- a/goto.bash +++ b/goto.bash @@ -148,15 +148,13 @@ function _goto_register_alias() local duplicate duplicate=$(_goto_find_duplicate "$directory") + if [ -n "$duplicate" ]; then + _goto_warning "duplicate alias(es) found: \\n$duplicate" + fi # Append entry to file. echo "$1 $directory" >> "$GOTO_DB" echo "Alias '$1' registered successfully." - - if [ -n "$duplicate" ]; then - echo -e "note: duplicate alias found:\n$duplicate" - return - fi } # Unregisters the given alias.