]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
bash-completion/resolvectl: support privatedns command
authorYu Watanabe <watanabe.yu+github@gmail.com>
Wed, 13 Jun 2018 02:16:26 +0000 (11:16 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Wed, 13 Jun 2018 02:16:26 +0000 (11:16 +0900)
shell-completion/bash/resolvectl
shell-completion/bash/systemd-resolve

index 9ffbbbcf1ee5f7a09f9e4da33beb709d6e3337a3..a8b24bc757e9b771040faad1ec8251739cb85542 100644 (file)
@@ -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
index ecd1ebad54e60929674df568a180fd1f478a357c..7bcd13563cf9807dc74aed697d203a36c574890c 100644 (file)
@@ -65,6 +65,9 @@ _systemd-resolve() {
                         --set-dnssec)
                                 comps="yes no allow-downgrade"
                                 ;;
+                        --set-privatedns)
+                                comps="no opportunistic"
+                                ;;
                 esac
                 COMPREPLY=( $(compgen -W '$comps' -- "$cur") )
                 return 0