diff options
author | Yu Watanabe <watanabe.yu+github@gmail.com> | 2018-06-13 11:16:26 +0900 |
---|---|---|
committer | Sven Eden <yamakuzure@gmx.net> | 2018-08-24 16:47:08 +0200 |
commit | 54a443dd8b21fc59a043f63f17e6db2d419cdacb (patch) | |
tree | 521c3e0cb1269ae9ff92389c0c627d13ed5be640 /shell-completion | |
parent | 0d2592f8b1f71c81d7710c92421ef06e5d4c4825 (diff) |
bash-completion/resolvectl: support privatedns command
Diffstat (limited to 'shell-completion')
-rw-r--r-- | shell-completion/bash/resolvectl | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/shell-completion/bash/resolvectl b/shell-completion/bash/resolvectl index cb897fd65..dcacb1269 100644 --- a/shell-completion/bash/resolvectl +++ b/shell-completion/bash/resolvectl @@ -48,12 +48,14 @@ _resolvectl() { [LINK]='revert dns domain nta' [RESOLVE]='llmnr mdns' [DNSSEC]='dnssec' + [PRIVATEDNS]='privatedns' [STANDALONE]='statistics reset-statistics flush-caches reset-server-features' ) local -A ARGS=( [FAMILY]='tcp udp sctp' [RESOLVE]='yes no resolve' [DNSSEC]='yes no allow-downgrade' + [PRIVATEDNS]='no opportunistic' ) local interfaces=$( __get_interfaces ) @@ -109,7 +111,7 @@ _resolvectl() { comps="" fi - elif __contains_word "$verb" ${VERBS[LINK]} ${VERBS[RESOLVE]} ${VERBS[DNSSEC]}; then + elif __contains_word "$verb" ${VERBS[LINK]} ${VERBS[RESOLVE]} ${VERBS[DNSSEC]} ${VERBS[PRIVATEDNS]}; then for ((i++; i < COMP_CWORD; i++)); do if __contains_word "${COMP_WORDS[i]}" $interfaces && ! __contains_word "${COMP_WORDS[i-1]}" ${OPTS[ARG]}; then @@ -153,6 +155,22 @@ _resolvectl() { comps='' fi + elif __contains_word "$verb" ${VERBS[PRIVATEDNS]}; then + name= + for ((i++; i < COMP_CWORD; i++)); do + if __contains_word "${COMP_WORDS[i]}" ${ARGS[PRIVATEDNS]} && + ! __contains_word "${COMP_WORDS[i-1]}" ${OPTS[ARG]}; then + name=${COMP_WORDS[i]} + break; + fi + done + + if [[ -z $name ]]; then + comps=${ARGS[PRIVATEDNS]} + else + comps='' + fi + else comps='' fi |