summaryrefslogtreecommitdiffstats
path: root/shell-completion/bash/resolvectl
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-12 03:50:45 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-12 03:50:45 +0000
commitefeb864cb547a2cbf96dc0053a8bdb4d9190b364 (patch)
treec0b83368f18be983fcc763200c4c24d633244588 /shell-completion/bash/resolvectl
parentReleasing progress-linux version 255.5-1~progress7.99u1. (diff)
downloadsystemd-efeb864cb547a2cbf96dc0053a8bdb4d9190b364.tar.xz
systemd-efeb864cb547a2cbf96dc0053a8bdb4d9190b364.zip
Merging upstream version 256.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'shell-completion/bash/resolvectl')
-rw-r--r--shell-completion/bash/resolvectl17
1 files changed, 9 insertions, 8 deletions
diff --git a/shell-completion/bash/resolvectl b/shell-completion/bash/resolvectl
index bd3e8bf..344eaad 100644
--- a/shell-completion/bash/resolvectl
+++ b/shell-completion/bash/resolvectl
@@ -1,3 +1,4 @@
+# shellcheck shell=bash
# resolvectl(1) completion -*- shell-script -*-
# SPDX-License-Identifier: LGPL-2.1-or-later
#
@@ -23,7 +24,7 @@ __contains_word () {
done
}
-__get_interfaces(){
+__get_interfaces() {
local name
for name in $(cd /sys/class/net && command ls); do
[[ "$name" != "lo" ]] && echo "$name"
@@ -35,10 +36,10 @@ _resolvectl() {
local cur=${COMP_WORDS[COMP_CWORD]} prev=${COMP_WORDS[COMP_CWORD-1]}
local -A OPTS=(
[STANDALONE]='-h --help --version -4 -6 --legend=no --cname=no
- --validate=no --synthesize=no --cache=no --zone=no
+ --validate=no --synthesize=no --cache=no --relax-single-label=no --zone=no
--trust-anchor=no --network=no --service-address=no
--service-txt=no --search=no --stale-data=no --no-pager'
- [ARG]='-t --type -c --class -i --interface -p --protocol --raw'
+ [ARG]='-t --type -c --class -i --interface -p --protocol --raw --json'
)
local -A VERBS=(
[DOMAIN]='query service openpgp'
@@ -49,7 +50,7 @@ _resolvectl() {
[RESOLVE]='llmnr mdns'
[DNSSEC]='dnssec'
[DNSOVERTLS]='dnsovertls'
- [STANDALONE]='statistics reset-statistics flush-caches reset-server-features show-cache'
+ [STANDALONE]='statistics reset-statistics flush-caches reset-server-features monitor show-cache show-server-state'
[LOG_LEVEL]='log-level'
)
local -A ARGS=(
@@ -59,14 +60,13 @@ _resolvectl() {
[DNSSEC]='yes no allow-downgrade'
[DNSOVERTLS]='yes no opportunistic'
)
- local interfaces=$( __get_interfaces )
if __contains_word "$prev" ${OPTS[ARG]}; then
case $prev in
--interface|-i)
- comps="$interfaces"
+ comps=$( __get_interfaces )
;;
- --protocol|-p|--type|-t|--class|-c)
+ --protocol|-p|--type|-t|--class|-c|--json)
comps=$( resolvectl --legend=no "$prev" help; echo help )
;;
--raw)
@@ -97,7 +97,7 @@ _resolvectl() {
comps=''
elif __contains_word "$verb" ${VERBS[STATUS]}; then
- comps="$interfaces"
+ comps=$( __get_interfaces )
elif __contains_word "$verb" ${VERBS[LOG_LEVEL]}; then
comps='debug info notice warning err crit alert emerg'
@@ -117,6 +117,7 @@ _resolvectl() {
fi
elif __contains_word "$verb" ${VERBS[LINK]} ${VERBS[BOOLEAN]} ${VERBS[RESOLVE]} ${VERBS[DNSSEC]} ${VERBS[DNSOVERTLS]}; then
+ local interfaces=$( __get_interfaces )
for ((i++; i < COMP_CWORD; i++)); do
if __contains_word "${COMP_WORDS[i]}" $interfaces &&
! __contains_word "${COMP_WORDS[i-1]}" ${OPTS[ARG]}; then