| 1 |
# D2122 https://github.com/akinomyoga/ble.sh/issues/394 |
| 2 |
|
| 3 |
if ble/bin#has kubectl; then |
| 4 |
eval "$(kubectl completion bash)" |
| 5 |
else |
| 6 |
# https://github.com/akinomyoga/ble.sh/issues/394#issuecomment-1913122045 |
| 7 |
source bashrc.kubectl |
| 8 |
fi |
| 9 |
|
| 10 |
source /etc/profile.d/bash_completion.sh |
| 11 |
|
| 12 |
kubectl() { echo "KUBECTL $*" >/dev/tty; } |
| 13 |
alias k=kubectl |
| 14 |
complete -o default -F __start_kubectl k |
| 15 |
|
| 16 |
alias e='echo hello >/dev/tty' |
| 17 |
complete -F _test1 test1 |
| 18 |
_test1() { eval "e xxxx"; } |
| 19 |
|
| 20 |
complete -F _test2 test2 |
| 21 |
_test2() { eval "e xxxx" | cat; } |
| 22 |
|
| 23 |
complete -F _test3 test3 |
| 24 |
_test3() { (eval "e xxxx"); } |
| 25 |
|
| 26 |
complete -F _test4 test4 |
| 27 |
_test4() { eval "e xxxx" & wait; } |
| 28 |
|
| 29 |
complete -F _test5 test5 |
| 30 |
_test5() { |
| 31 |
if ble/complete/check-cancel <&"$_ble_util_fd_stdin"; then |
| 32 |
echo 'CANCELED' >/dev/tty |
| 33 |
((_ble_decode_input_count)) && echo _ble_decode_input_count |
| 34 |
((ble_decode_char_rest)) && echo ble_decode_char_rest |
| 35 |
ble/util/is-stdin-ready && echo stdin-ready |
| 36 |
ble/encoding:"$bleopt_input_encoding"/is-intermediate && echo UTF-8 intermediate |
| 37 |
ble-decode-char/is-intermediate && echo decode-char/intermediate |
| 38 |
return 1 |
| 39 |
fi |
| 40 |
ble/util/conditional-sync \ |
| 41 |
'e xxxx' \ |
| 42 |
"! ble/complete/check-cancel <&$_ble_util_fd_stdin" 128 progressive-weight:killall |
| 43 |
} |
| 44 |
|
| 45 |
complete -F _test6 test6 |
| 46 |
_test6() { (eval "e xxxx" & wait); } |
| 47 |
|
| 48 |
complete -F _test7 test7 |
| 49 |
_test7() { [[ str ]] && eval "e xxxx" & } |