summaryrefslogtreecommitdiffstats
path: root/completions/curl
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-04 01:03:19 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-04 01:03:19 +0000
commit6c09f2a45c5541e9c207d14fc7aa21a4a0066bde (patch)
tree0221189d367bf661f6f9493c4f17a03f0dd4b7d2 /completions/curl
parentReleasing progress-linux version 1:2.11-8~progress7.99u1. (diff)
downloadbash-completion-6c09f2a45c5541e9c207d14fc7aa21a4a0066bde.tar.xz
bash-completion-6c09f2a45c5541e9c207d14fc7aa21a4a0066bde.zip
Merging upstream version 1:2.12.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'completions/curl')
-rw-r--r--completions/curl145
1 files changed, 104 insertions, 41 deletions
diff --git a/completions/curl b/completions/curl
index 6e84269..6cbbca4 100644
--- a/completions/curl
+++ b/completions/curl
@@ -1,48 +1,59 @@
# curl(1) completion -*- shell-script -*-
-_curl()
+_comp_cmd_curl()
{
- local cur prev words cword
- _init_completion || return
+ local cur prev words cword comp_args
+ _comp_initialize -n : -- "$@" || return
+ local noargopts='!(-*|*[KbcDoTCFmQreYytzuAwEdHPxX]*)'
+ # shellcheck disable=SC2254
case $prev in
- --ciphers | --connect-timeout | --continue-at | --form | --form-string | \
- --ftp-account | --ftp-alternative-to-user | --ftp-port | --header | --help | \
- --hostpubmd5 | --keepalive-time | --krb | --limit-rate | --local-port | \
- --mail-from | --mail-rcpt | --max-filesize | --max-redirs | --max-time | --pass | \
- --proto | --proto-redir | --proxy-user | --proxy1.0 | --quote | --range | \
- --request | --retry | --retry-delay | --retry-max-time | \
- --socks5-gssapi-service | --telnet-option | --tftp-blksize | --time-cond | \
- --url | --user | --user-agent | --version | --write-out | --resolve | --tlsuser | \
- --tlspassword | -!(-*)[CFPHhmQrXtzuAVw])
+ --abstract-unix-socket | --alt-svc | --config | --cookie | \
+ --cookie-jar | --dump-header | --egd-file | --etag-compare | \
+ --etag-save | --hsts | --key | --libcurl | --netrc-file | \
+ --output | --proxy-key | --random-file | --trace | --trace-ascii | \
+ --unix-socket | --upload-file | -${noargopts}[KbcDoT])
+ _comp_compgen_filedir
return
;;
- --config | --cookie | --cookie-jar | --dump-header | --egd-file | \
- --key | --libcurl | --output | --random-file | --upload-file | --trace | \
- --trace-ascii | --netrc-file | -!(-*)[KbcDoT])
- _filedir
+ --ciphers | --connect-timeout | --connect-to | --continue-at | \
+ --curves | --data-raw | --doh-url | --expect100-timeout | --form | \
+ --form-string | --ftp-account | --ftp-alternative-to-user | \
+ --happy-eyeballs-timeout-ms | --hostpubmd5 | --keepalive-time | \
+ --limit-rate | --local-port | --login-options | --mail-auth | \
+ --mail-from | --mail-rcpt | --max-filesize | --max-redirs | \
+ --max-time | --pass | --proto | --proto-default | --proto-redir | \
+ --proxy-ciphers | --proxy-pass | --proxy-service-name | \
+ --proxy-tls13-ciphers | --proxy-tlspassword | --proxy-tlsuser | \
+ --proxy-user | --proxy1.0 | --quote | --range | --referer | \
+ --resolve | --retry | --retry-delay | --retry-max-time | \
+ --sasl-authzid | --service-name | --socks5-gssapi-service | \
+ --speed-limit | --speed-time | --telnet-option | --tftp-blksize | \
+ --time-cond | --tls13-ciphers | --tlspassword | --tlsuser | \
+ --url | --user | --user-agent | --version | --write-out | \
+ -${noargopts}[CFmQreYytzuAVw])
return
;;
- --cacert | --cert | -!(-*)E)
- _filedir '@(c?(e)rt|cer|pem|der)'
+ --cacert | --cert | --proxy-cacert | --proxy-cert | -${noargopts}E)
+ _comp_compgen_filedir '@(c?(e)rt|cer|pem|der)'
return
;;
- --capath)
- _filedir -d
+ --capath | --output-dir | --proxy-capath)
+ _comp_compgen_filedir -d
return
;;
- --cert-type | --key-type)
- COMPREPLY=($(compgen -W 'DER PEM ENG' -- "$cur"))
+ --cert-type | --key-type | --proxy-cert-type | --proxy-key-type)
+ _comp_compgen -- -W 'DER PEM ENG'
return
;;
- --crlfile)
- _filedir crl
+ --crlfile | --proxy-crlfile)
+ _comp_compgen_filedir crl
return
;;
- --data | --data-ascii | --data-binary | --data-urlencode | -!(-*)d)
+ --data | --data-ascii | --data-binary | --data-urlencode | --header | \
+ --proxy-header | -${noargopts}[dH])
if [[ $cur == \@* ]]; then
- cur=${cur:1}
- _filedir
+ _comp_compgen -c "${cur:1}" filedir
if [[ ${#COMPREPLY[@]} -eq 1 && -d ${COMPREPLY[0]} ]]; then
COMPREPLY[0]+=/
compopt -o nospace
@@ -52,48 +63,100 @@ _curl()
return
;;
--delegation)
- COMPREPLY=($(compgen -W 'none policy always' -- "$cur"))
+ _comp_compgen -- -W 'none policy always'
+ return
+ ;;
+ --dns-ipv[46]-addr)
+ _comp_compgen_ip_addresses -"${prev:9:1}"
+ return
+ ;;
+ --dns-servers | --noproxy)
+ _comp_compgen_known_hosts -- "${cur##*,}"
+ ((${#COMPREPLY[@]})) &&
+ _comp_delimited , -W '"${COMPREPLY[@]}"'
return
;;
--engine)
- COMPREPLY=($(compgen -W 'list' -- "$cur"))
+ local engines=$(
+ "$1" --engine list 2>/dev/null |
+ command grep "^[[:space:]]"
+ )
+ _comp_compgen -- -W '$engines list'
+ return
+ ;;
+ --ftp-port | -${noargopts}P)
+ _comp_compgen_available_interfaces -a
+ _comp_compgen -a known_hosts -- "$cur"
+ _comp_compgen -a ip_addresses -a
return
;;
--ftp-method)
- COMPREPLY=($(compgen -W 'multicwd nocwd singlecwd' -- "$cur"))
+ _comp_compgen -- -W 'multicwd nocwd singlecwd'
return
;;
--ftp-ssl-ccc-mode)
- COMPREPLY=($(compgen -W 'active passive' -- "$cur"))
+ _comp_compgen -- -W 'active passive'
return
;;
--interface)
- _available_interfaces -a
+ _comp_compgen_available_interfaces -a
+ return
+ ;;
+ --help | -${noargopts}h)
+ local x categories
+ if _comp_split categories "$("$1" --help non-existent-category 2>&1 |
+ _comp_awk '/^[ \t]/ {print $1}')"; then
+ for x in "${categories[@]}"; do
+ # Looks like an option? Likely no --help category support
+ [[ $x != -* ]] || return
+ done
+ _comp_compgen -- -W '"${categories[@]}"'
+ fi
return
;;
- --proxy | --socks4 | --socks4a | --socks5 | --socks5-hostname | -!(-*)x)
- _known_hosts_real -- "$cur"
+ --krb)
+ _comp_compgen -- -W 'clear safe confidential private'
+ return
+ ;;
+ --pinnedpubkey | --proxy-pinnedpubkey)
+ _comp_compgen_filedir '@(pem|der|key)'
+ return
+ ;;
+ --preproxy | --proxy | --socks4 | --socks4a | --socks5 | \
+ --socks5-hostname | -${noargopts}x)
+ _comp_compgen_known_hosts -- "$cur"
return
;;
--pubkey)
- _xfunc ssh _ssh_identityfile pub
+ _comp_compgen -x ssh identityfile pub
+ return
+ ;;
+ --request | -${noargopts}X)
+ # TODO: these are valid for http(s) only
+ _comp_compgen -- -W 'GET HEAD POST PUT DELETE CONNECT OPTIONS TRACE
+ PATCH'
return
;;
--stderr)
- COMPREPLY=($(compgen -W '-' -- "$cur"))
- _filedir
+ _comp_compgen -- -W '-'
+ _comp_compgen -a filedir
+ return
+ ;;
+ --tls-max)
+ _comp_compgen -- -W 'default 1.0 1.1 1.2 1.3'
return
;;
- --tlsauthtype)
- COMPREPLY=($(compgen -W 'SRP' -- "$cur"))
+ --tlsauthtype | --proxy-tlsauthtype)
+ _comp_compgen -- -W 'SRP'
return
;;
esac
if [[ $cur == -* ]]; then
- COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur"))
+ _comp_compgen_help -- --help all
+ [[ ${COMPREPLY-} ]] || _comp_compgen_help
fi
} &&
- complete -F _curl curl
+ complete -F _comp_cmd_curl curl
# ex: filetype=sh