Fix auto completion
This commit is contained in:
parent
b53e0f6654
commit
03b02b9094
@ -5,6 +5,7 @@ _dropshell_completions() {
|
||||
COMPREPLY=()
|
||||
cur="${COMP_WORDS[COMP_CWORD]}"
|
||||
prev="${COMP_WORDS[COMP_CWORD-1]}"
|
||||
root="${COMP_WORDS[1]}"
|
||||
|
||||
# List of main commands
|
||||
opts="help version servers templates autocomplete_list_servers autocomplete_list_services autocomplete_list_commands install backup"
|
||||
@ -20,8 +21,8 @@ _dropshell_completions() {
|
||||
fi
|
||||
|
||||
# Command-specific completions
|
||||
case "${prev}" in
|
||||
status|templates|autocomplete_list_servers|autocomplete_list_services|autocomplete_list_commands)
|
||||
case "${root}" in
|
||||
templates|autocomplete_list_servers|autocomplete_list_services|autocomplete_list_commands)
|
||||
# No additional completions for these commands
|
||||
COMPREPLY=()
|
||||
return 0
|
||||
@ -49,7 +50,7 @@ _dropshell_completions() {
|
||||
;;
|
||||
*)
|
||||
# if ${prev} is not in ${commands}
|
||||
if [[ ! " ${commands[*]} " =~ " ${prev} " ]]; then
|
||||
if [[ ! " ${commands[*]} " =~ " ${root} " ]]; then
|
||||
COMPREPLY=()
|
||||
return 0
|
||||
fi
|
||||
|
Loading…
x
Reference in New Issue
Block a user