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
This commit is contained in:
Debarshi Ray 2019-04-26 16:16:16 +02:00
parent 3694b599d6
commit 22b2d40830

View file

@ -26,25 +26,25 @@ __toolbox() {
_init_completion -s || return _init_completion -s || return
if [ "${COMP_CWORD}" -eq 1 ]; then 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 return 0
fi fi
case "$prev" in case "$prev" in
--verbose) --verbose)
COMPREPLY=($(compgen -W "$verbose_commands" -- "$2")) mapfile -t COMPREPLY < <(compgen -W "$verbose_commands" -- "$2")
return 0 return 0
;; ;;
--container) --container)
COMPREPLY=($(compgen -W "$(__toolbox_containers)" -- "$2")) mapfile -t COMPREPLY < <(compgen -W "$(__toolbox_containers)" -- "$2")
return 0 return 0
;; ;;
--image) --image)
COMPREPLY=($(compgen -W "$(__toolbox_images)" -- "$2")) mapfile -t COMPREPLY < <(compgen -W "$(__toolbox_images)" -- "$2")
return 0 return 0
;; ;;
--release) --release)
COMPREPLY=($(compgen -W "$(seq $MIN_VERSION $RAWHIDE_VERSION)" -- "$2")) mapfile -t COMPREPLY < <(compgen -W "$(seq $MIN_VERSION $RAWHIDE_VERSION)" -- "$2")
return 0 return 0
;; ;;
esac esac
@ -65,7 +65,7 @@ __toolbox() {
extra_comps="$(__toolbox_images)" extra_comps="$(__toolbox_images)"
;;& ;;&
*) *)
COMPREPLY=($(compgen -W "${options[$command]} $extra_comps" -- "$2")) mapfile -t COMPREPLY < <(compgen -W "${options[$command]} $extra_comps" -- "$2")
return 0; return 0;
;; ;;
esac esac