From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 22953 invoked by alias); 30 Mar 2018 14:07:15 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: List-Unsubscribe: X-Seq: 42570 Received: (qmail 27873 invoked by uid 1010); 30 Mar 2018 14:07:15 -0000 X-Qmail-Scanner-Diagnostics: from park01.gkg.net by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.99.2/21882. spamassassin: 3.4.1. Clear:RC:0(205.235.26.22):SA:0(-1.4/5.0):. Processed in 17.099355 secs); 30 Mar 2018 14:07:15 -0000 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.4 required=5.0 tests=BAYES_00, FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS, SPF_PASS,T_DKIM_INVALID,T_RP_MATCHES_RCVD autolearn=no autolearn_force=no version=3.4.1 X-Envelope-From: SRS0=g5DA=GU=yahoo.co.uk=okiddle@bounces.park01.gkg.net X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | X-Virus-Scanned: by amavisd-new at gkg.net Authentication-Results: amavisd4.gkg.net (amavisd-new); dkim=pass (2048-bit key) header.d=yahoo.co.uk X-Greylist: domain auto-whitelisted by SQLgrey-1.8.0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.co.uk; s=s2048; t=1522418798; bh=o7t8GZsyyQWvMUlWK5EsZKcLT7y0FU6r9f4b3FS7t48=; h=From:To:Subject:Date:From:Subject; b=UGK7gQvXodxtUMg2zq9hC9+GRhpkRPSx10C6W+H16HizAsOKr/lHntW06cB5Odbmb1O6OJZjUoG0CaMozeauSTB6MgWqwdLqHWNGf8/qmY/k6ArrvL7Kzo+FIBVkxLPqHeu2FXOkUPNE2FI8RAnAmn65ch6JEZhShDPswCc5ldMeXKI0pyYMQ40iY4Pw4SnE7ft5fj7TMNK+/yP/5vt+H/Tv8aEdvZPrv+0wSvRlf8Ty7LqP26b9WOlhS8oJX6QcUD0w6/r28IN/UBIqSn+O7s+qhcMkHmQ84CY7KCeWneBBWyGYl7QPZpagKOQQw9v2lzIMh0VVGtyiSROEZQlzCQ== X-YMail-OSG: g1qmmlcVM1nlInZLhbUfPyPzrswmOwTUO_n2aPbwf.mmds98bwvQO2oi8rzIspZ UQye7EiXMTBOpAN_YLFaH9lxx7AuWRlNqTD13ILlsEVmPeDbdgpWDy_xrEIQ2UPngUzGDUhtKGSV kx7wkhxLJAyOQpgzXigZh8fi2c6jOWQHIahF8JBt7ghIjBqKmWrlmpGnA43WKv.iKNQdw61ouN4H XmnzGEkap3l3_QDcnT3yMTcwlmtrc3HIvlZEqjuX1Umef1Qu6Vvx_lXw9ZVXi9AoxrAh2KRKODhV wVxc9ideUEd4IpldBeTIzyrk88kyd5leFxL0KBJOVQSBNvSidFPf7OacUKsH69uMYwcsLlnJAQ20 4NK2I8Xo6pdiKK4sO9kzZPjPqogZsC6oGGeAOx3UqiK9KkBdp2ZtyA7oeYOTE4yISevWNrC2UEpK f_mOYX94o8GlwjqSvwGMcbwhb9qnumyYDvaxBlxRKnKu_0J5gN.iyA7YYwnObZh8TvyA9YXM1_gu 8SJKzI1cInRycVo7aaehARCFagn4- From: Oliver Kiddle To: Zsh workers Subject: PATCH: completion for drill (ldns-utils) MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <18571.1522409586.1@thecus> Date: Fri, 30 Mar 2018 13:33:06 +0200 Message-ID: <18572.1522409586@thecus> This adds completion for drill which is similar to dig. I factored out the _dns_types function so that it can be shared by both. The _drill function should perhaps be named _ldns but it is perhaps better to rename it only if other ldns utilities get completion. Oliver diff --git a/Completion/Unix/Command/_dig b/Completion/Unix/Command/_dig index a4e175808..5feb71fef 100644 --- a/Completion/Unix/Command/_dig +++ b/Completion/Unix/Command/_dig @@ -1,14 +1,5 @@ #compdef dig -_dns_types() { - local expl - _description dns-types expl 'DNS type' - compadd "$@" "$expl[@]" -M 'm:{a-z}={A-Z}' \ - ANY A AAAA AFSDB APL AXFR CAA CDNSKEY CDS CERT CNAME DHCID DLV DNAME \ - DNSKEY DS HIP HINFO IPSECKEY IXFR KEY KX LOC MX NAPTR NS NSEC NSEC3 \ - NSEC3PARAM OPT PTR RRSIG RP SIG SOA SPF SRV SSHFP TA TKEY TLSA TSIG TXT -} - local curcontext="$curcontext" state line expl local -a alts args [[ -prefix + ]] && args=( @@ -66,7 +57,7 @@ local -a alts args '*+'{no,}'besteffort[try to parse even malformed messages]' '*+'{no,}'dnssec[request DNSSEC records]' '*+'{no,}'sigchase[chase DNSSEC signature chains]' - '*+trusted-key=[specify file conrtaing trusted kets]:file:_files' + '*+trusted-key=[specify file containing trusted keys]:file:_files' '*+'{no,}'topdown[do DNSSEC validation in top down mode]' '*+'{no,}'nsid[include EDNS name server ID request in query]' '*+'{no,}'ttlid[display the TTL whening printing the record]' diff --git a/Completion/Unix/Command/_drill b/Completion/Unix/Command/_drill new file mode 100644 index 000000000..68fa7917b --- /dev/null +++ b/Completion/Unix/Command/_drill @@ -0,0 +1,46 @@ +#compdef drill + +local curcontext="$curcontext" ret=1 +local -a state line expl + +_arguments -s -S -C \ + '-D[enable DNSSEC (DO bit)]' \ + '-T[trace from the root down]' \ + '-S[chase signature(s) to a known key]' \ + '-I[specify source address to query from]:source address' \ + '(-Q)-V+[specify verbosity]:number (0-5)' \ + '(-V)-Q[quiet mode (overrules -V)]' \ + '-f+[read packet from file and send it]:file:_files' \ + '-i+[read packet from file and print it]:file:_files' \ + '-w+[write answer packet to file]:file:_files' \ + '-q+[write query packet to file]:file:_files' \ + '(- *)-h[display usage information]' \ + '(- *)-v[display version information]' \ + '(-6)-4[stay on ipv4]' \ + '(-4)-6[stay on ipv6]' \ + '-a[fallback to EDNS0 and TCP if the answer is truncated]' \ + '-b+[specify buffer size (defaults to 512 b)]:size (bytes) [512]' \ + '-c+[use specified file for rescursive nameserver configuration]:file [/etc/resolv.conf]:_files' \ + '-k+[specify a file that contains a trusted DNSSEC key]:file:_files' \ + '*-o+[set/unset header bits]:mnemonic (uppercase sets, lower unsets):_sequence compadd - QR qr AA aa TC tc RD rd CD cd RA ra AD ad' \ + '-p+[use specified remote port number]:port:_ports' \ + '-s[show the DS RR for each key in a packet]' \ + '-x[do a reverse lookup]' \ + '-r+[use specified file as root servers hint file]:file:_files' \ + '-t[send the query with tcp]' '!(-t)-u' \ + '-d+[use specified domain as the start point for the trace]:domain' \ + '-y+[specify named base64 tsig key, and optional algorithm]:name\:key\:algorithm [hmac-md5.sig-alg.reg.int]' \ + "-z[don't randomize the nameservers before use]" \ + '*:args:->args' && ret=0 + +if [[ -n $state ]]; then + if compset -P @; then + _wanted hosts expl 'DNS server' _hosts && ret=0; + else + _alternative 'hosts:host:_hosts' \ + 'types:query type:_dns_types' \ + 'classes:query class:compadd -M "m:{a-z}={A-Z}" - IN CS CH HS' && ret=0 + fi +fi + +return ret diff --git a/Completion/Unix/Type/_dns_types b/Completion/Unix/Type/_dns_types new file mode 100644 index 000000000..b6bc2e680 --- /dev/null +++ b/Completion/Unix/Type/_dns_types @@ -0,0 +1,8 @@ +#autoload + +local expl +_description dns-types expl 'DNS type' +compadd "$@" "$expl[@]" -M 'm:{a-z}={A-Z}' \ + ANY A AAAA AFSDB APL AXFR CAA CDNSKEY CDS CERT CNAME DHCID DLV DNAME \ + DNSKEY DS HIP HINFO IPSECKEY IXFR KEY KX LOC MX NAPTR NS NSEC NSEC3 \ + NSEC3PARAM OPT PTR RRSIG RP SIG SOA SPF SRV SSHFP TA TKEY TLSA TSIG TXT