diff --git a/goto.sh b/goto.sh index 4af91e0..2f02f73 100644 --- a/goto.sh +++ b/goto.sh @@ -25,7 +25,7 @@ function goto() { local target - GOTO_DB="$HOME/.goto" + _goto_resolve_db if [ -z "$1" ]; then # display usage and exit when no args @@ -61,6 +61,11 @@ function goto() return $? } +function _goto_resolve_db() +{ + GOTO_DB="$HOME/.goto" +} + function _goto_usage() { cat <<\USAGE @@ -268,6 +273,7 @@ function _complete_goto_commands() function _complete_goto_aliases() { local IFS=$'\n' matches + _goto_resolve_db # shellcheck disable=SC2207 matches=($(sed -n "/^$1/p" "$GOTO_DB" 2>/dev/null))