]> git.ipfire.org Git - thirdparty/systemd.git/blame - shell-completion/zsh/_resolvectl
improve zsh completion (#32098)
[thirdparty/systemd.git] / shell-completion / zsh / _resolvectl
CommitLineData
682e043c 1#compdef resolvectl systemd-resolve
db9ecf05 2# SPDX-License-Identifier: LGPL-2.1-or-later
e81eb287
ZJS
3#
4# This file is part of systemd.
5#
e81eb287
ZJS
6# systemd is free software; you can redistribute it and/or modify it
7# under the terms of the GNU Lesser General Public License as published by
8# the Free Software Foundation; either version 2.1 of the License, or
9# (at your option) any later version.
10#
11# systemd is distributed in the hope that it will be useful, but
12# WITHOUT ANY WARRANTY; without even the implied warranty of
13# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14# General Public License for more details.
15#
16# You should have received a copy of the GNU Lesser General Public License
85fce6f4 17# along with systemd; If not, see <https://www.gnu.org/licenses/>.
e81eb287 18
f65ccde2
RP
19(( $+functions[_resolvectl_protocols] )) ||
20 _resolvectl_protocols() {
843cfcb1
ZJS
21 local -a _protocol
22 _protocol=( $(_call_program protocol ${service} --legend=no --protocol help; echo help) )
23 _values 'protocol' "$_protocol[@]"
24 }
e81eb287 25
f65ccde2
RP
26(( $+functions[_resolvectl_types] )) ||
27 _resolvectl_types() {
843cfcb1
ZJS
28 local -a _type
29 _type=( $(_call_program type ${service} --legend=no --type help; echo help) )
30 _values 'type' "$_type[@]"
31 }
e81eb287 32
f65ccde2
RP
33(( $+functions[_resolvectl_classes] )) ||
34 _resolvectl_classes() {
843cfcb1
ZJS
35 local -a _class
36 _class=( $(_call_program class ${service} --legend=no --class help; echo help) )
37 _values 'class' "$_class[@]"
38 }
e81eb287 39
24c55b67
RP
40(( $+functions[_resolvectl_commands] )) ||
41 _resolvectl_commands() {
42 local -a _resolvectl_cmds
43 _resolvectl_cmds=(
44 default-route:"Configure per-interface default-route setting"
45 dns:"Configure per-interface DNS configuration"
46 dnsovertls:"Configure per-interface dnsovertls enabled status"
47 dnssec:"Configure per-interface dnssec enabled status"
48 domain:"Configure per-interface search and route-only domains"
49 flush-caches:"Flushes all DNS resource record caches the service maintains locally"
50 llmnr:"Configure per-interface llmnr enabled status"
51 mdns:"Configure per-interface mdns enabled status"
52 nta:"Configure per-interface nta domains"
53 openpgp:"Retrieve openpgp keys for an email"
54 query:"Resolve domain names, IPv4 and IPv6 addresses"
55 reset-server-features:"Flushes all feature level information the resolver has learned about specific servers"
d0192e93 56 reset-statistics:"Resets the statistics counter shown in statistics to zero"
24c55b67
RP
57 revert:"Revert the per-interfce DNS configuration"
58 service:"Resolve DNS-SD and SRV services"
77d49864 59 show-cache:"Show the current cache contents"
d0192e93 60 statistics:"Show resolver statistics"
24c55b67
RP
61 status:"Show the global and per-link DNS settings currently in effect"
62 tlsa:"Query tlsa public keys stored as TLSA resource records"
63 )
64
65 if (( CURRENT == 1 )); then
66 _describe -t commands 'resolvectl commands' _resolvectl_cmds
67 fi
68}
e81eb287
ZJS
69
70_arguments \
20927c0e
EK
71 '(- *)'{-h,--help}'[Print a short help text and exit]' \
72 '(- *)--version[Print a short version string and exit]' \
73 '--legend=[Do not show headers and footers]:BOOL:(yes no)' \
e81eb287
ZJS
74 '-4[Resolve IPv4 addresses]' \
75 '-6[Resolve IPv6 addresses]' \
20927c0e
EK
76 '(-i --interface)'{-i+,--interface=}'[Look on interface]:interface:_net_interfaces' \
77 '(-p --protocol)'{-p+,--protocol=}'[Look via protocol]:protocol:_resolvectl_protocols' \
78 '(-t --type)'{-t+,--type=}'[Query RR with DNS type]:type:_resolvectl_types' \
79 '(-c --class)'{-c+,--class=}'[Query RR with DNS class]:class:_resolvectl_classes' \
e81eb287 80 '--service[Resolve services]' \
20927c0e
EK
81 '--service-address=[Do not resolve address for services]:BOOL:(yes no)' \
82 '--service-txt=[Do not resolve TXT records for services]:BOOL:(yes no)' \
83 '--cname=[Do not follow CNAME redirects]:BOOL:(yes no)' \
84 '--search=[Do not use search domains]:BOOL:(yes no)' \
24c55b67 85 '*::default: _resolvectl_commands'