From 22b2d408306c2b4eb21b4cc971a000329a1ea105 Mon Sep 17 00:00:00 2001 From: Debarshi Ray Date: Fri, 26 Apr 2019 16:16:16 +0200 Subject: [PATCH] completion: Silence SC2207 Otherwise https://www.shellcheck.net/ would complain: Line 29: COMPREPLY=($(compgen -W "--help --verbose $commands" -- "$2")) ^-- SC2207: Prefer mapfile or read -a to split command output (or quote to avoid splitting). See: https://github.com/koalaman/shellcheck/wiki/SC2207 --- completion/bash/toolbox | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/completion/bash/toolbox b/completion/bash/toolbox index 3427da1..c2936f7 100644 --- a/completion/bash/toolbox +++ b/completion/bash/toolbox @@ -26,25 +26,25 @@ __toolbox() { _init_completion -s || return if [ "${COMP_CWORD}" -eq 1 ]; then - COMPREPLY=($(compgen -W "--assumeyes --help --verbose $commands" -- "$2")) + mapfile -t COMPREPLY < <(compgen -W "--assumeyes --help --verbose $commands" -- "$2") return 0 fi case "$prev" in --verbose) - COMPREPLY=($(compgen -W "$verbose_commands" -- "$2")) + mapfile -t COMPREPLY < <(compgen -W "$verbose_commands" -- "$2") return 0 ;; --container) - COMPREPLY=($(compgen -W "$(__toolbox_containers)" -- "$2")) + mapfile -t COMPREPLY < <(compgen -W "$(__toolbox_containers)" -- "$2") return 0 ;; --image) - COMPREPLY=($(compgen -W "$(__toolbox_images)" -- "$2")) + mapfile -t COMPREPLY < <(compgen -W "$(__toolbox_images)" -- "$2") return 0 ;; --release) - COMPREPLY=($(compgen -W "$(seq $MIN_VERSION $RAWHIDE_VERSION)" -- "$2")) + mapfile -t COMPREPLY < <(compgen -W "$(seq $MIN_VERSION $RAWHIDE_VERSION)" -- "$2") return 0 ;; esac @@ -65,7 +65,7 @@ __toolbox() { extra_comps="$(__toolbox_images)" ;;& *) - COMPREPLY=($(compgen -W "${options[$command]} $extra_comps" -- "$2")) + mapfile -t COMPREPLY < <(compgen -W "${options[$command]} $extra_comps" -- "$2") return 0; ;; esac