chiark / gitweb /
tree-wide: beautify remaining copyright statements
[elogind.git] / shell-completion / bash / resolvectl
index cb897fd65e7b4554e0566305f153e42f18f3f3c4..bec8b759e2299bd9be619a05f4d67e0fab40f05b 100644 (file)
@@ -3,7 +3,7 @@
 #
 # This file is part of elogind.
 #
-# Copyright 2018 Yu Watanabe
+# Copyright © 2018 Yu Watanabe
 #
 # elogind is free software; you can redistribute it and/or modify it
 # under the terms of the GNU Lesser General Public License as published by
@@ -48,12 +48,14 @@ _resolvectl() {
                      [LINK]='revert dns domain nta'
                   [RESOLVE]='llmnr mdns'
                    [DNSSEC]='dnssec'
+               [DNSOVERTLS]='dnsovertls'
                [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'
+               [DNSOVERTLS]='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[DNSOVERTLS]}; 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[DNSOVERTLS]}; then
+                        name=
+                        for ((i++; i < COMP_CWORD; i++)); do
+                                if __contains_word "${COMP_WORDS[i]}" ${ARGS[DNSOVERTLS]} &&
+                                 ! __contains_word "${COMP_WORDS[i-1]}" ${OPTS[ARG]}; then
+                                        name=${COMP_WORDS[i]}
+                                        break;
+                                fi
+                        done
+
+                        if [[ -z $name ]]; then
+                                comps=${ARGS[DNSOVERTLS]}
+                        else
+                                comps=''
+                        fi
+
                 else
                         comps=''
                 fi