1
+ # compdef awl
2
+ # SPDX-License-Identifier: BSD-3-Clause
3
+
4
+ local curcontext=" $curcontext " state line expl
5
+ local -a alts args
6
+ [[ -p refix + ]] && args=(
7
+ ' *+' {no,}' tcp[use TCP instead of UDP for queries]'
8
+ ' *+' {no,}' ignore[ignore truncation in UDP responses]'
9
+ ' *+' {no,}' tls[use DNS-over-TLS for queries]'
10
+ ' *+' {no,}' dnscrypt[use DNSCrypt for queries]'
11
+ ' *+' {no,}' https[use DNS-over-HTTPS for queries]'
12
+ ' *+' {no,}' quic[use DNS-over-QUIC for queries]'
13
+ ' *+' {no,}' aaonly[set aa flag in the query]'
14
+ ' *+' {no,}' additional[print additional section of a reply]'
15
+ ' *+' {no,}' adflag[set the AD (authentic data) bit in the query]'
16
+ ' *+' {no,}' cdflag[set the CD (checking disabled) bit in the query]'
17
+ ' *+' {no,}' cookie[add a COOKIE option to the request]'
18
+ ' *+edns=[specify EDNS version for query]:version (0-255)'
19
+ ' *+noedns[clear EDNS version to be sent]'
20
+ ' *+ednsflags=[set EDNS flags bits]:flags'
21
+ # '*+ednsopt=[specify EDNS option]:code point'
22
+ ' *+noedns[clear EDNS options to be sent]'
23
+ ' *+' {no,}' expire[send an EDNS Expire option]'
24
+ # '*+'{no,}'idnin[set processing of IDN domain names on input]'
25
+ ' *+' {no,}' idnout[set conversion of IDN puny code on output]'
26
+ ' *+' {no,}' keepalive[request EDNS TCP keepalive]'
27
+ ' *+' {no,}' keepopen[keep TCP socket open between queries]'
28
+ ' *+' {no,}' recurse[set the RD (recursion desired) bit in the query]'
29
+ # '*+'{no,}'nssearch[search all authoritative nameservers]'
30
+ # '*+'{no,}'trace[trace delegation down from root]'
31
+ # '*+'{no,}'cmd[print initial comment in output]'
32
+ ' *+' {no,}' short[print terse output]'
33
+ ' *+' {no,}' identify[print IP and port of responder]'
34
+ ' *+' {no,}' comments[print comment lines in output]'
35
+ ' *+' {no,}' stats[print statistics]'
36
+ ' *+padding[set padding block size]:size [0]'
37
+ ' *+' {no,}' qr[print query as it was sent]'
38
+ ' *+' {no,}' question[print question section of a query]'
39
+ ' *+' {no,}' raflag[set RA flag in the query]'
40
+ ' *+' {no,}' answer[print answer section of a reply]'
41
+ ' *+' {no,}' authority[print authority section of a reply]'
42
+ ' *+' {no,}' all[set all print/display flags]'
43
+ ' *+' {no,}' subnet=[send EDNS client subnet option]:addr/prefix-length'
44
+ ' *+' {no,}' tcflag[set TC flag in the query]'
45
+ ' *+time=[set query timeout]:timeout (seconds) [1]'
46
+ ' *+timeout=[set query timeout]:timeout (seconds) [1]'
47
+ ' *+tries=[specify number of UDP query attempts]:tries [3]'
48
+ ' *+retry=[specify number of UDP query retries]:retries [2]'
49
+ # '*+'{no,}'rrcomments[set display of per-record comments]'
50
+ # '*+ndots=[specify number of dots to be considered absolute]:dots'
51
+ ' *+bufsize=[specify UDP buffer size]:size (bytes)'
52
+ ' *+' {no,}' dnssec[enable DNSSEC]'
53
+ ' *+' {no,}' nsid[include EDNS name server ID request in query]'
54
+ ' *+' {no,}' class[display the class whening printing the answer]'
55
+ ' *+' {no,}' ttlid[display the TTL whening printing the record]'
56
+ ' *+' {no,}' ttlunits[display the TTL in human-readable units]'
57
+ # '*+'{no,}'unknownformat[print RDATA in RFC 3597 "unknown" format]'
58
+ ' *+' {no,}' json[present the results as JSON]'
59
+ ' *+' {no,}' xml[present the results as XML]'
60
+ ' *+' {no,}' yaml[present the results as YAML]'
61
+ ' *+' {no,}' zflag[set Z flag in query]'
62
+ )
63
+ # TODO: Add the regular (POSIX/GNU) flags
64
+ _arguments -s -C $args \
65
+ ' (- *)-' {h,-help}' [display help information]' \
66
+ ' (- *)-' {V,-version}' [display version information]' \
67
+ ' -' {v,-verbosity}' =+[set verbosity to custom level]:verbosity:compadd -M "m\:{\-1-3}={\-1-3}" - \-1 0 1 2 3' \
68
+ ' -' {v,-verbosity}' +[set verbosity to info]' \
69
+ ' *-' {p,-port}' +[specify port number]:port:_ports' \
70
+ ' *-' {q,-query}' +[specify host name to query]:host:_hosts' \
71
+ ' *-' {c,-class}' +[specify class]:class:compadd -M "m\:{a-z}={A-Z}" - IN CS CH HS' \
72
+ ' *-' {t,-qType}' +[specify type]:type:_dns_types' \
73
+ ' *-4+[force IPv4 only]' \
74
+ ' *-6+[force IPv6 only]' \
75
+ ' *-' {x,-reverse}' +[reverse lookup]' \
76
+ ' *--timeout+[timeout in seconds]:number [1]' \
77
+ ' *--retry+[specify number of UDP query retries]:number [2]' \
78
+ ' *--no-edns+[disable EDNS]' \
79
+ ' *--edns-ver+[specify EDNS version for query]:version (0-255) [0]' \
80
+ ' *-' {D,-dnssec}' +[enable DNSSEC]' \
81
+ ' *--expire+[send EDNS expire]' \
82
+ ' *-' {n,-nsid}' +[include EDNS name server ID request in query]' \
83
+ ' *--no-cookie+[disable sending EDNS cookie]' \
84
+ ' *--keep-alive+[request EDNS TCP keepalive]' \
85
+ ' *-' {b,-buffer-size}' +[specify UDP buffer size]:size (bytes) [1232]' \
86
+ ' *--zflag+[set EDNS z-flag]:decimal, hex or octal [0]' \
87
+ ' *--subnet+[set EDNS client subnet]:addr/prefix-length' \
88
+ ' *--no-truncate+[ignore truncation in UDP responses]' \
89
+ ' *--tcp+[use TCP instead of UDP for queries]' \
90
+ ' *--dnscrypt+[use DNSCrypt for queries]' \
91
+ ' *-' {T,-tls}' +[use DNS-over-TLS for queries]' \
92
+ ' *-' {H,-https}' +[use DNS-over-HTTPS for queries]' \
93
+ ' *-' {Q,-quic}' +[use DNS-over-QUIC for queries]' \
94
+ ' *--tls-no-verify+[disable TLS verification]' \
95
+ ' *--tls-host+[set TLS lookup hostname]:host:_hosts' \
96
+ ' *-' {s,-short}' +[print terse output]' \
97
+ ' *-' {j,-json}' +[present the results as JSON]' \
98
+ ' *-' {x,-xml}' +[present the results as XML]' \
99
+ ' *-' {y,-yaml}' +[present the results as YAML]' \
100
+ ' *: :->args' && ret=0
101
+
102
+ if [[ -n $state ]]; then
103
+ if compset -P @; then
104
+ _wanted hosts expl ' DNS server' _hosts && ret=0;
105
+ else
106
+ _alternative ' hosts:host:_hosts' ' types:query type:_dns_types' && ret=0
107
+ fi
108
+ fi
109
+
110
+ return ret
0 commit comments