summaryrefslogtreecommitdiff
path: root/shell-completion
diff options
context:
space:
mode:
authorYu Watanabe <watanabe.yu+github@gmail.com>2022-05-08 13:34:11 +0900
committerDaan De Meyer <daan.j.demeyer@gmail.com>2022-05-08 14:14:28 +0200
commit4e5f4733c59048fe9984dc00432e1732f8b0ec8c (patch)
tree0036c01c3d290cc837d6b632a7a29e5b9f322e1a /shell-completion
parent97d670a4297d4d3ffd21748b70c1a669a67d4e0f (diff)
downloadsystemd-4e5f4733c59048fe9984dc00432e1732f8b0ec8c.tar.gz
bash-completion: resolvectl: add missing options and verb
Diffstat (limited to 'shell-completion')
-rw-r--r--shell-completion/bash/resolvectl29
1 files changed, 24 insertions, 5 deletions
diff --git a/shell-completion/bash/resolvectl b/shell-completion/bash/resolvectl
index cbe2aa4870..fa4a27a8ae 100644
--- a/shell-completion/bash/resolvectl
+++ b/shell-completion/bash/resolvectl
@@ -34,16 +34,18 @@ _resolvectl() {
local i comps verb name
local cur=${COMP_WORDS[COMP_CWORD]} prev=${COMP_WORDS[COMP_CWORD-1]}
local -A OPTS=(
- [STANDALONE]='-h --help --version --no-pager -4 -6
- --service-address=no --service-txt=no
- --cname=no --search=no --legend=no'
- [ARG]='-i --interface -p --protocol -t --type -c --class --raw'
+ [STANDALONE]='-h --help --version -4 -6 --legend=no --cname=no
+ --validate=no --synthesize=no --cache=no --zone=no
+ --trust-anchor=no --network=no --service-address=no
+ --service-txt=no --search=no --no-pager'
+ [ARG]='-t --type -c --class -i --interface -p --protocol --raw'
)
local -A VERBS=(
[DOMAIN]='query service openpgp'
[FAMILY]='tlsa'
[STATUS]='status'
[LINK]='revert dns domain nta'
+ [BOOLEAN]='default-route'
[RESOLVE]='llmnr mdns'
[DNSSEC]='dnssec'
[DNSOVERTLS]='dnsovertls'
@@ -52,6 +54,7 @@ _resolvectl() {
)
local -A ARGS=(
[FAMILY]='tcp udp sctp'
+ [BOOLEAN]='yes no'
[RESOLVE]='yes no resolve'
[DNSSEC]='yes no allow-downgrade'
[DNSOVERTLS]='yes no opportunistic'
@@ -113,7 +116,7 @@ _resolvectl() {
comps=""
fi
- elif __contains_word "$verb" ${VERBS[LINK]} ${VERBS[RESOLVE]} ${VERBS[DNSSEC]} ${VERBS[DNSOVERTLS]}; then
+ elif __contains_word "$verb" ${VERBS[LINK]} ${VERBS[BOOLEAN]} ${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
@@ -141,6 +144,22 @@ _resolvectl() {
comps=''
fi
+ elif __contains_word "$verb" ${VERBS[BOOLEAN]}; then
+ name=
+ for ((i++; i < COMP_CWORD; i++)); do
+ if __contains_word "${COMP_WORDS[i]}" ${ARGS[BOOLEAN]} &&
+ ! __contains_word "${COMP_WORDS[i-1]}" ${OPTS[ARG]}; then
+ name=${COMP_WORDS[i]}
+ break;
+ fi
+ done
+
+ if [[ -z $name ]]; then
+ comps=${ARGS[BOOLEAN]}
+ else
+ comps=''
+ fi
+
elif __contains_word "$verb" ${VERBS[DNSSEC]}; then
name=
for ((i++; i < COMP_CWORD; i++)); do