diff --git a/bin/bash_completion.sh b/bin/bash_completion.sh index 319059e694..17663d8c24 100644 --- a/bin/bash_completion.sh +++ b/bin/bash_completion.sh @@ -1,9 +1,11 @@ +# shellcheck shell=bash # # Bash completion file for CakePHP console. # Copy this file to a file named `cake` under `/etc/bash_completion.d/`. # For more info check https://book.cakephp.org/5/en/console-commands/completion.html#how-to-enable-bash-autocompletion-for-the-cakephp-console # - +# Keep `COMPREPLY=( $(compgen ...) )`, because mapfile is unavailable in Bash 3.2, the macOS default. +# shellcheck disable=SC2207 _cake() { local cur prev opts cake @@ -21,20 +23,20 @@ _cake() opts=$(${cake} completion options "${COMP_WORDS[1]}" "${COMP_WORDS[2]}") fi - COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) ) + COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 fi if [[ ${COMP_CWORD} = 1 ]] ; then opts=$(${cake} completion commands) - COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) ) + COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 fi if [[ ${COMP_CWORD} = 2 ]] ; then - opts=$(${cake} completion subcommands $prev) - COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) ) - if [[ $COMPREPLY = "" ]] ; then + opts=$(${cake} completion subcommands "${prev}") + COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) + if [[ ${#COMPREPLY[@]} -eq 0 ]] ; then _filedir return 0 fi diff --git a/bin/cake b/bin/cake index 4b696c883f..6ad1112b66 100755 --- a/bin/cake +++ b/bin/cake @@ -56,7 +56,6 @@ then fi CONSOLE=$(dirname -- "$(canonicalize "$realname")") -APP=$(dirname "$CONSOLE") # If your CLI PHP is somewhere that this doesn't find, you can define a PHP environment # variable with the correct path in it.