(feat)Completions and documentation #78

Merged
sam merged 10 commits from completions-et-al into master 2022-09-04 23:28:48 +00:00
3 changed files with 51 additions and 31 deletions
Showing only changes of commit 12ea0e094d - Show all commits

View file

@ -9,17 +9,17 @@ local testing(version, arch) = {
},
steps: [
{
name: "submodules",
image: "alpine/git",
name: "compile",
image: "golang:" + version,
commands: [
"git submodule update --init --recursive"
]
"make awl"
],
},
{
name: "lint",
image: "rancher/drone-golangci-lint:latest",
depends_on: [
"submodules",
"compile",
],
},
{
@ -29,7 +29,7 @@ local testing(version, arch) = {
"make test-ci"
],
depends_on: [
"submodules",
"lint",
],
},
{
@ -39,7 +39,7 @@ local testing(version, arch) = {
"make fuzz",
],
depends_on: [
"submodules",
"lint",
],
},
],
@ -68,7 +68,6 @@ local release() = {
image: "alpine/git",
commands : [
"git fetch --tags",
"git submodule update --init --recursive"
]
},
{
@ -95,9 +94,9 @@ local release() = {
[
testing("1.19", "amd64"),
testing("1.19", "arm64"),
testing("1.18", "amd64"),
testing("1.18", "arm64"),
// testing("1.19", "arm64"),
// testing("1.18", "amd64"),
// testing("1.18", "arm64"),
release()
]

View file

@ -21,7 +21,7 @@ local -a alts args
# '*+ednsopt=[specify EDNS option]:code point'
'*+noedns[clear EDNS options to be sent]'
'*+'{no,}'expire[send an EDNS Expire option]'
'*+'{no,}'idnin[set processing of IDN domain names on input]'
# '*+'{no,}'idnin[set processing of IDN domain names on input]'
'*+'{no,}'idnout[set conversion of IDN puny code on output]'
'*+'{no,}'keepalive[request EDNS TCP keepalive]'
'*+'{no,}'keepopen[keep TCP socket open between queries]'
@ -40,7 +40,7 @@ local -a alts args
'*+'{no,}'answer[print answer section of a reply]'
'*+'{no,}'authority[print authority section of a reply]'
'*+'{no,}'all[set all print/display flags]'
'*+'{no,}'subnet[send EDNS client subnet option]:addr/prefix-length'
'*+'{no,}'subnet=[send EDNS client subnet option]:addr/prefix-length'
'*+'{no,}'tcflag[set TC flag in the query]'
'*+time=[set query timeout]:timeout (seconds) [1]'
'*+timeout=[set query timeout]:timeout (seconds) [1]'
@ -51,6 +51,7 @@ local -a alts args
'*+bufsize=[specify UDP buffer size]:size (bytes)'
'*+'{no,}'dnssec[enable DNSSEC]'
'*+'{no,}'nsid[include EDNS name server ID request in query]'
'*+'{no,}'class[display the class whening printing the answer]'
'*+'{no,}'ttlid[display the TTL whening printing the record]'
'*+'{no,}'ttlunits[display the TTL in human-readable units]'
# '*+'{no,}'unknownformat[print RDATA in RFC 3597 "unknown" format]'
@ -61,21 +62,42 @@ local -a alts args
)
# TODO: Add the regular (POSIX/GNU) flags
_arguments -s -C $args \
'(- *)-h[display help information]' \
'(- *)-V[display version information]' \
'-v=+[set verbosity]:verbosity:compadd -M "m\:{\-1-3}={\-1-3}" - \-1 0 1 2 3' \
'(- *)-'{h,-help}'[display help information]' \
'(- *)-'{V,-version}'[display version information]' \
'-'{v,-verbosity}'=+[set verbosity to custom level]:verbosity:compadd -M "m\:{\-1-3}={\-1-3}" - \-1 0 1 2 3' \
'-'{v,-verbosity}'+[set verbosity to info]' \
'*-'{p,-port}'+[specify port number]:port:_ports' \
'*-'{q,-query}'+[specify host name to query]:host:_hosts' \
'*-'{c,-class}'+[specify class]:class:compadd -M "m\:{a-z}={A-Z}" - IN CS CH HS' \
'*-'{t,-qtype}'+[specify type]:type:_dns_types' \
'*--tls-no-verify[disable TLS verification]' \
'*-'{t,-qType}'+[specify type]:type:_dns_types' \
'*-4+[force IPv4 only]' \
'*-6+[force IPv6 only]' \
'*-'{x,-reverse}'+[reverse lookup]' \
'*--timeout+[timeout in seconds]:number [1]' \
'*--retry+[specify number of UDP query retries]:number [2]' \
'*--no-edns+[disable EDNS]' \
'*--edns-ver+[specify EDNS version for query]:version (0-255) [0]' \
'*-'{D,-dnssec}'+[enable DNSSEC]' \
'*--expire+[send EDNS expire]' \
'*-'{n,-nsid}'+[include EDNS name server ID request in query]' \
'*--no-cookie+[disable sending EDNS cookie]' \
'*--keep-alive+[request EDNS TCP keepalive]' \
'*-'{b,-buffer-size}'+[specify UDP buffer size]:size (bytes) [1232]' \
'*--zflag+[set EDNS z-flag]:decimal, hex or octal [0]' \
'*--subnet+[set EDNS client subnet]:addr/prefix-length' \
'*--no-truncate+[ignore truncation in UDP responses]' \
'*--tcp+[use TCP instead of UDP for queries]' \
'*--dnscrypt+[use DNSCrypt for queries]' \
'*-'{T,-tls}'+[use DNS-over-TLS for queries]' \
'*-'{H,-https}'+[use DNS-over-HTTPS for queries]' \
'*-'{Q,-quic}'+[use DNS-over-QUIC for queries]' \
'*--tls-no-verify+[disable TLS verification]' \
'*--tls-host+[set TLS lookup hostname]:host:_hosts' \
'*-'{-,}'4[force IPv4 only]' \
'*-'{-,}'6[force IPv6 only]' \
'*-x+[reverse lookup]:IP address' \
'*-'{s,-short}'+[print terse output]' \
'*-'{j,-json}'+[present the results as JSON]' \
'*-'{x,-xml}'+[present the results as XML]' \
'*-'{y,-yaml}'+[present the results as YAML]' \
'*: :->args' && ret=0
# '*--timeout+[timeout in seconds]:number [1]' \
# '*--retry+[number of tries before failing]:number [2]' \
if [[ -n $state ]]; then
if compset -P @; then

View file

@ -52,19 +52,17 @@ lint: fmt vet
## test: run go test
test: $(TEST_SOURCES)
$(TEST) -coverprofile=coverage/coverage.out ./...
$(TEST) -v -coverprofile=coverage/coverage.out ./...
.PHONY: test-ci
test-ci:
$(TEST) -v
$(TEST) ./...
## fuzz: runs fuzz tests
fuzz: $(TEST_SOURCES)
cd cli
$(TEST) -fuzz=FuzzFlags -fuzztime 10000x
$(TEST) -fuzz=FuzzDig -fuzztime 10000x
$(TEST) -fuzz=FuzzParseArgs -fuzztime 10000x
cd ..
$(TEST) -fuzz=FuzzFlags -fuzztime 10000x ./cli
$(TEST) -fuzz=FuzzDig -fuzztime 10000x ./cli
$(TEST) -fuzz=FuzzParseArgs -fuzztime 5000x ./cli
.PHONY: full_test
full_test: test fuzz
@ -80,7 +78,8 @@ cover: coverage/coverage.out
.PHONY: clean
clean:
$(GO) clean
rm doc/$(PROG).1
# Ignore errors if you remove something that doesn't exist
rm -f doc/$(PROG).1
## help: Prints this help message
.PHONY: help