improve (completions): simplify and fix enable logic
parent
3a778072db
commit
150d054fe6
|
|
@ -1,61 +1,48 @@
|
||||||
# shellcheck shell=bash
|
# shellcheck shell=bash
|
||||||
|
|
||||||
__vuejs_completion() {
|
if _command_exists vue; then
|
||||||
# shellcheck disable=SC2155
|
__vuejs_completion() {
|
||||||
local prev=$(_get_pword)
|
local cmd=${COMP_WORDS[1]}
|
||||||
# shellcheck disable=SC2155
|
|
||||||
local curr=$(_get_cword)
|
|
||||||
|
|
||||||
case $prev in
|
case $cmd in
|
||||||
create)
|
create)
|
||||||
# shellcheck disable=SC2207
|
COMPREPLY=(-p -d -i -m -r -g -n -f -c -x -b -h --help --preset --default --inilinePreset --packageManager --registry --git --no-git --force --merge --clone --proxy --bare --skipGetStarted)
|
||||||
COMPREPLY=($(compgen -W "-p -d -i -m -r -g -n -f -c -x -b -h --help --preset --default --inilinePreset --packageManager --registry --git --no-git --force --merge --clone --proxy --bare --skipGetStarted" -- "$curr"))
|
;;
|
||||||
;;
|
add | invoke)
|
||||||
add | invoke)
|
COMPREPLY=(--registry -h --help)
|
||||||
# shellcheck disable=SC2207
|
;;
|
||||||
COMPREPLY=($(compgen -W "--registry -h --help" -- "$curr"))
|
inspect)
|
||||||
;;
|
COMPREPLY=(-v -h --help --verbose --mode --rule --plugin --plugins --rules)
|
||||||
inspect)
|
;;
|
||||||
# shellcheck disable=SC2207
|
serve)
|
||||||
COMPREPLY=($(compgen -W "-v --help --verbose --mode --rule --plugin --plugins --rules" -- "$curr"))
|
COMPREPLY=(-o -h --help --open -c --copy -p --port)
|
||||||
;;
|
;;
|
||||||
serve)
|
build)
|
||||||
# shellcheck disable=SC2207
|
COMPREPLY=(-t --target -n --name -d --dest -h --help)
|
||||||
COMPREPLY=($(compgen -W "-o -h --help --open -c --copy -p --port" -- "$curr"))
|
;;
|
||||||
;;
|
ui)
|
||||||
build)
|
COMPREPLY=(-H --host -p --port -D --dev --quiet --headless -h --help)
|
||||||
# shellcheck disable=SC2207
|
;;
|
||||||
COMPREPLY=($(compgen -W "-t --target -n --name -d --dest -h --help" -- "$curr"))
|
init)
|
||||||
;;
|
COMPREPLY=(-c --clone --offline -h --help)
|
||||||
ui)
|
;;
|
||||||
# shellcheck disable=SC2207
|
config)
|
||||||
COMPREPLY=($(compgen -W "-H --host -p --port -D --dev --quiet --headless -h --help" -- "$curr"))
|
COMPREPLY=(-g --get -s --set -d --delete -e --edit --json -h --help)
|
||||||
;;
|
;;
|
||||||
init)
|
outdated)
|
||||||
# shellcheck disable=SC2207
|
COMPREPLY=(--next -h --help)
|
||||||
COMPREPLY=($(compgen -W "-c --clone --offline -h --help" -- "$curr"))
|
;;
|
||||||
;;
|
upgrade)
|
||||||
config)
|
COMPREPLY=(-t --to -f --from -r --registry --all --next -h --help)
|
||||||
# shellcheck disable=SC2207
|
;;
|
||||||
COMPREPLY=($(compgen -W "-g --get -s --set -d --delete -e --edit --json -h --help" -- "$curr"))
|
migrate)
|
||||||
;;
|
COMPREPLY=(-f --from -h --help)
|
||||||
outdated)
|
;;
|
||||||
# shellcheck disable=SC2207
|
*)
|
||||||
COMPREPLY=($(compgen -W "--next -h --help" -- "$curr"))
|
COMPREPLY=(-h --help -V --version create add invoke inspect serve build ui init config outdated upgrade migrate info)
|
||||||
;;
|
;;
|
||||||
upgrade)
|
esac
|
||||||
# shellcheck disable=SC2207
|
}
|
||||||
COMPREPLY=($(compgen -W "-t --to -f --from -r --registry --all --next -h --help" -- "$curr"))
|
|
||||||
;;
|
|
||||||
migrate)
|
|
||||||
# shellcheck disable=SC2207
|
|
||||||
COMPREPLY=($(compgen -W "-f --from -h --help" -- "$curr"))
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
# shellcheck disable=SC2207
|
|
||||||
COMPREPLY=($(compgen -W "-h --help -v --version create add invoke inspect serve build ui init config outdated upgrade migrate info" -- "$curr"))
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
}
|
|
||||||
|
|
||||||
complete -F __vuejs_completion vue
|
complete -F __vuejs_completion -X '!&*' vue
|
||||||
|
fi
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue