From ae7e85180e6575e3547d4651c19ac952dfd508c1 Mon Sep 17 00:00:00 2001 From: Lazarus Lazaridis Date: Fri, 9 Mar 2018 00:47:17 +0200 Subject: [PATCH] Don't use mapfile. Refs #12. --- goto.bash | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/goto.bash b/goto.bash index b31ee73..48e3153 100644 --- a/goto.bash +++ b/goto.bash @@ -227,7 +227,10 @@ function _goto_resolve_alias() # Completes the goto function with the available commands function _complete_goto_commands() { - mapfile -t COMPREPLY < <(compgen -W '-r --register -u --unregister -l --list -c --cleanup -v --version' -- "$1") + local IFS=$' \t\n' + + # shellcheck disable=SC2207 + COMPREPLY=($(compgen -W "-r --register -u --unregister -l --list -c --cleanup" -- "$1")) } # Completes the goto function with the available aliases @@ -235,7 +238,8 @@ function _complete_goto_aliases() { local IFS=$'\n' matches al - mapfile -t matches < <(sed -n "/^$1/p" ~/.goto 2>/dev/null) + # shellcheck disable=SC2207 + matches=($(sed -n "/^$1/p" ~/.goto 2>/dev/null)) if [ "${#matches[@]}" -eq "1" ]; then # remove the filenames attribute from the completion method @@ -289,7 +293,10 @@ function _complete_goto() if [[ $prev = "-r" ]] || [[ $prev = "--register" ]]; then # prompt with directories only if user tries to register an alias - mapfile -t COMPREPLY < <(compgen -d -- "$cur") + # shellcheck disable=SC2207 + local IFS=$' \t\n' + + COMPREPLY=($(compgen -d -- "$cur")) fi fi }