Resolve goto db upon completion.

Fixes #20.
This commit is contained in:
Lazarus Lazaridis 2018-03-12 07:37:52 +02:00
parent 0b3b8527a9
commit 19393468fc

View File

@ -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))