aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYu Watanabe <watanabe.yu+github@gmail.com>2018-06-13 11:16:26 +0900
committerYu Watanabe <watanabe.yu+github@gmail.com>2018-06-13 11:16:26 +0900
commit1a363edad1944ce1f8fabb04725e20b57b9997ab (patch)
treea3049b2fcace7ff88e6f3e7c91ea412d2026d6c3
parentresolve: reject PrivateDNS=yes (diff)
downloadsystemd-1a363edad1944ce1f8fabb04725e20b57b9997ab.tar.gz
systemd-1a363edad1944ce1f8fabb04725e20b57b9997ab.tar.bz2
systemd-1a363edad1944ce1f8fabb04725e20b57b9997ab.zip
bash-completion/resolvectl: support privatedns command
-rw-r--r--shell-completion/bash/resolvectl20
-rw-r--r--shell-completion/bash/systemd-resolve3
2 files changed, 22 insertions, 1 deletions
diff --git a/shell-completion/bash/resolvectl b/shell-completion/bash/resolvectl
index 9ffbbbcf1..a8b24bc75 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
diff --git a/shell-completion/bash/systemd-resolve b/shell-completion/bash/systemd-resolve
index ecd1ebad5..7bcd13563 100644
--- a/shell-completion/bash/systemd-resolve
+++ b/shell-completion/bash/systemd-resolve
@@ -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