completion: Add bash-it doctor completion

Also fix the tests and add a new one
pull/1623/head
Noah Gorny 2020-06-20 20:15:12 +03:00
parent 86824a93ed
commit 1e674643b3
2 changed files with 17 additions and 7 deletions

View File

@ -65,7 +65,7 @@ _bash-it-comp()
prev="${COMP_WORDS[COMP_CWORD-1]}"
chose_opt="${COMP_WORDS[1]}"
file_type="${COMP_WORDS[2]}"
opts="disable enable help migrate reload search show update version"
opts="disable enable help migrate reload doctor search show update version"
case "${chose_opt}" in
show)
local show_args="aliases completions plugins"
@ -82,6 +82,11 @@ _bash-it-comp()
return 0
fi
;;
doctor)
local doctor_args="errors warnings all"
COMPREPLY=( $(compgen -W "${doctor_args}" -- ${cur}) )
return 0
;;
migrate | reload | search | update | version)
return 0
;;

View File

@ -43,6 +43,11 @@ function __check_completion () {
echo "${COMPREPLY[@]}"
}
@test "completion bash-it: doctor - show options" {
run __check_completion 'bash-it doctor '
assert_line -n 0 "errors warnings all"
}
@test "completion bash-it: help - show options" {
run __check_completion 'bash-it help '
assert_line -n 0 "aliases completions migrate plugins update"
@ -70,32 +75,32 @@ function __check_completion () {
@test "completion bash-it: show options" {
run __check_completion 'bash-it '
assert_line -n 0 "disable enable help migrate reload search show update version"
assert_line -n 0 "disable enable help migrate reload doctor search show update version"
}
@test "completion bash-it: bash-ti - show options" {
run __check_completion 'bash-ti '
assert_line -n 0 "disable enable help migrate reload search show update version"
assert_line -n 0 "disable enable help migrate reload doctor search show update version"
}
@test "completion bash-it: shit - show options" {
run __check_completion 'shit '
assert_line -n 0 "disable enable help migrate reload search show update version"
assert_line -n 0 "disable enable help migrate reload doctor search show update version"
}
@test "completion bash-it: bashit - show options" {
run __check_completion 'bashit '
assert_line -n 0 "disable enable help migrate reload search show update version"
assert_line -n 0 "disable enable help migrate reload doctor search show update version"
}
@test "completion bash-it: batshit - show options" {
run __check_completion 'batshit '
assert_line -n 0 "disable enable help migrate reload search show update version"
assert_line -n 0 "disable enable help migrate reload doctor search show update version"
}
@test "completion bash-it: bash_it - show options" {
run __check_completion 'bash_it '
assert_line -n 0 "disable enable help migrate reload search show update version"
assert_line -n 0 "disable enable help migrate reload doctor search show update version"
}
@test "completion bash-it: show - show options" {