completion/composer: lint
parent
a4fe6267b6
commit
d91525be3f
|
|
@ -3,14 +3,14 @@ cite "about-completion"
|
||||||
about-completion "composer completion"
|
about-completion "composer completion"
|
||||||
|
|
||||||
function __composer_completion() {
|
function __composer_completion() {
|
||||||
local cur coms opts com
|
local cur coms opts com words
|
||||||
COMPREPLY=()
|
COMPREPLY=()
|
||||||
_get_comp_words_by_ref -n : cur words
|
_get_comp_words_by_ref -n : cur words
|
||||||
|
|
||||||
# lookup for command
|
# lookup for command
|
||||||
for word in "${words[@]:1}"; do
|
for word in "${words[@]:1}"; do
|
||||||
if [[ $word != -* ]]; then
|
if [[ "${word}" != -* ]]; then
|
||||||
com=$word
|
com="${word}"
|
||||||
break
|
break
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
@ -19,7 +19,7 @@ function __composer_completion() {
|
||||||
if [[ ${cur} == --* ]]; then
|
if [[ ${cur} == --* ]]; then
|
||||||
opts="--help --quiet --verbose --version --ansi --no-ansi --no-interaction --profile --no-plugins --working-dir"
|
opts="--help --quiet --verbose --version --ansi --no-ansi --no-interaction --profile --no-plugins --working-dir"
|
||||||
|
|
||||||
case "$com" in
|
case "${com}" in
|
||||||
about)
|
about)
|
||||||
opts="${opts} "
|
opts="${opts} "
|
||||||
;;
|
;;
|
||||||
|
|
@ -109,18 +109,18 @@ function __composer_completion() {
|
||||||
|
|
||||||
# shellcheck disable=SC2207
|
# shellcheck disable=SC2207
|
||||||
COMPREPLY=($(compgen -W "${opts}" -- "${cur}"))
|
COMPREPLY=($(compgen -W "${opts}" -- "${cur}"))
|
||||||
__ltrim_colon_completions "$cur"
|
__ltrim_colon_completions "${cur}"
|
||||||
|
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# completing for a command
|
# completing for a command
|
||||||
if [[ "$cur" == "$com" ]]; then
|
if [[ "${cur}" == "${com}" ]]; then
|
||||||
coms="about archive browse clear-cache config create-project depends diagnose dump-autoload exec global help init install licenses list outdated prohibits remove require run-script search self-update show status suggests update validate"
|
coms="about archive browse clear-cache config create-project depends diagnose dump-autoload exec global help init install licenses list outdated prohibits remove require run-script search self-update show status suggests update validate"
|
||||||
|
|
||||||
# shellcheck disable=SC2207
|
# shellcheck disable=SC2207
|
||||||
COMPREPLY=($(compgen -W "${coms}" -- "${cur}"))
|
COMPREPLY=($(compgen -W "${coms}" -- "${cur}"))
|
||||||
__ltrim_colon_completions "$cur"
|
__ltrim_colon_completions "${cur}"
|
||||||
|
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue