|
1 | 1 | # shellcheck shell=bash
|
2 | 2 |
|
3 |
| -__vuejs_completion() { |
4 |
| - # shellcheck disable=SC2155 |
5 |
| - local prev=$(_get_pword) |
6 |
| - # shellcheck disable=SC2155 |
7 |
| - local curr=$(_get_cword) |
| 3 | +# Make sure vue is installed |
| 4 | +_bash-it-completion-helper-necessary vue || : |
| 5 | + |
| 6 | +# Don't handle completion if it's already managed |
| 7 | +_bash-it-completion-helper-sufficient vue || return |
| 8 | + |
| 9 | +function _vuejs() { |
| 10 | + local prev="${COMP_WORDS[COMP_CWORD - 1]}" |
8 | 11 |
|
9 | 12 | case $prev in
|
10 | 13 | create)
|
11 |
| - # shellcheck disable=SC2207 |
12 |
| - 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")) |
| 14 | + COMPREPLY=("-p" "-d" "-i" "-m" "-r" "-g" "-n" "-f" "-c" "-x" "-b" |
| 15 | + "-h" "--help" "--preset" "--default" "--inilinePreset" |
| 16 | + "--packageManager" "--registry" "--git" "--no-git" "--force" |
| 17 | + "--merge" "--clone" "--proxy" "--bare" "" "--skipGetStarted") |
13 | 18 | ;;
|
14 | 19 | add | invoke)
|
15 |
| - # shellcheck disable=SC2207 |
16 |
| - COMPREPLY=($(compgen -W "--registry -h --help" -- "$curr")) |
| 20 | + COMPREPLY=("--registry" "-h" "--help") |
17 | 21 | ;;
|
18 | 22 | inspect)
|
19 |
| - # shellcheck disable=SC2207 |
20 |
| - COMPREPLY=($(compgen -W "-v --help --verbose --mode --rule --plugin --plugins --rules" -- "$curr")) |
| 23 | + COMPREPLY=("-v" "--help" "--verbose" "--mode" "--rule" "--plugin" |
| 24 | + "--plugins" "--rules") |
21 | 25 | ;;
|
22 | 26 | serve)
|
23 |
| - # shellcheck disable=SC2207 |
24 |
| - COMPREPLY=($(compgen -W "-o -h --help --open -c --copy -p --port" -- "$curr")) |
| 27 | + COMPREPLY=("-o" "-h" "--help" "--open" "-c" "--copy" "-p" "--port") |
25 | 28 | ;;
|
26 | 29 | build)
|
27 |
| - # shellcheck disable=SC2207 |
28 |
| - COMPREPLY=($(compgen -W "-t --target -n --name -d --dest -h --help" -- "$curr")) |
| 30 | + COMPREPLY=("-t" "--target" "-n" "--name" "-d" "--dest" "-h" "--help") |
29 | 31 | ;;
|
30 | 32 | ui)
|
31 |
| - # shellcheck disable=SC2207 |
32 |
| - COMPREPLY=($(compgen -W "-H --host -p --port -D --dev --quiet --headless -h --help" -- "$curr")) |
| 33 | + COMPREPLY=("-H" "--host" "-p" "--port" "-D" "--dev" "--quiet" |
| 34 | + "--headless" "-h" "--help") |
33 | 35 | ;;
|
34 | 36 | init)
|
35 |
| - # shellcheck disable=SC2207 |
36 |
| - COMPREPLY=($(compgen -W "-c --clone --offline -h --help" -- "$curr")) |
| 37 | + COMPREPLY=("-c" "--clone" "--offline" "-h" "--help") |
37 | 38 | ;;
|
38 | 39 | config)
|
39 |
| - # shellcheck disable=SC2207 |
40 |
| - COMPREPLY=($(compgen -W "-g --get -s --set -d --delete -e --edit --json -h --help" -- "$curr")) |
| 40 | + COMPREPLY=("-g" "--get" "-s" "--set" "-d" "--delete" "-e" "--edit" |
| 41 | + "--json" "-h" "--help") |
41 | 42 | ;;
|
42 | 43 | outdated)
|
43 |
| - # shellcheck disable=SC2207 |
44 |
| - COMPREPLY=($(compgen -W "--next -h --help" -- "$curr")) |
| 44 | + COMPREPLY=("--next" "-h" "--help") |
45 | 45 | ;;
|
46 | 46 | upgrade)
|
47 |
| - # shellcheck disable=SC2207 |
48 |
| - COMPREPLY=($(compgen -W "-t --to -f --from -r --registry --all --next -h --help" -- "$curr")) |
| 47 | + COMPREPLY=("-t" "--to" "-f" "--from" "-r" "--registry" "--all" |
| 48 | + "--next" "-h" "--help") |
49 | 49 | ;;
|
50 | 50 | migrate)
|
51 |
| - # shellcheck disable=SC2207 |
52 |
| - COMPREPLY=($(compgen -W "-f --from -h --help" -- "$curr")) |
| 51 | + COMPREPLY=("-f" "--from" "-h" "--help") |
53 | 52 | ;;
|
54 | 53 | *)
|
55 |
| - # shellcheck disable=SC2207 |
56 |
| - COMPREPLY=($(compgen -W "-h --help -v --version create add invoke inspect serve build ui init config outdated upgrade migrate info" -- "$curr")) |
| 54 | + COMPREPLY=("-h" "--help" "-v" "--version" "create" "add" "invoke" |
| 55 | + "inspect" "serve" "build" "ui" "init" "config" "outdated" |
| 56 | + "upgrade" "migrate" "info") |
57 | 57 | ;;
|
58 | 58 | esac
|
59 | 59 | }
|
60 | 60 |
|
61 |
| -complete -F __vuejs_completion vue |
| 61 | +complete -F _vuejs -X '!&*' vue |
0 commit comments