summaryrefslogtreecommitdiffstats
path: root/completions/wget
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-04 01:03:18 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-04 01:03:18 +0000
commitf4acb49ea148cdd899f7f29f1591c7bc853c2135 (patch)
treeb62d60873864065d6428a84a119dd8a3c90f1397 /completions/wget
parentAdding upstream version 1:2.11. (diff)
downloadbash-completion-f4acb49ea148cdd899f7f29f1591c7bc853c2135.tar.xz
bash-completion-f4acb49ea148cdd899f7f29f1591c7bc853c2135.zip
Adding upstream version 1:2.12.0.upstream/1%2.12.0
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'completions/wget')
-rw-r--r--completions/wget118
1 files changed, 62 insertions, 56 deletions
diff --git a/completions/wget b/completions/wget
index d6a2fe9..fcc59aa 100644
--- a/completions/wget
+++ b/completions/wget
@@ -1,24 +1,26 @@
# wget(1) completion -*- shell-script -*-
-_wget()
+_comp_cmd_wget()
{
- local cur prev words cword split
- _init_completion -s || return
+ local cur prev words cword was_split comp_args
+ _comp_initialize -s -- "$@" || return
+ local noargopts='!(-*|*[DPoaOitTwlQeBUARIX]*)'
+ # shellcheck disable=SC2254
case $prev in
- --version | --help | -!(-*)[hV])
+ --version | --help | -${noargopts}[hV])
return
;;
--progress)
- COMPREPLY=($(compgen -W 'bar dot' -- "$cur"))
+ _comp_compgen -- -W 'bar dot'
return
;;
--bind-address)
- _ip_addresses
+ _comp_compgen_ip_addresses
return
;;
- --domains | --exclude-domains | -!(-*)D)
- _known_hosts_real -- "$cur"
+ --domains | --exclude-domains | -${noargopts}D)
+ _comp_compgen_known_hosts -- "$cur"
return
;;
--restrict-file-names)
@@ -47,84 +49,87 @@ _wget()
local lastopt=${cur/*,/} prevopt=
[[ $cur == *,* ]] && prevopt=${cur%,*},
- COMPREPLY=($(compgen -P "$prevopt" -X "@($excludes_str)" \
- -W 'unix windows nocontrol ascii lowercase uppercase' \
- -- "$lastopt"))
+ _comp_compgen -c "$lastopt" -- -P "$prevopt" \
+ -X "@($excludes_str)" \
+ -W 'unix windows nocontrol ascii lowercase uppercase'
# +o nospace when no more valid option is possible (= append a space)
- local opt_as_arr=(${COMPREPLY[0]//,/ })
+ local -a opt_as_arr
+ _comp_split -F $', \t\n' opt_as_arr "${COMPREPLY[0]}"
((${#opt_as_arr[@]} < 4)) && compopt -o nospace
return
;;
--prefer-family)
- COMPREPLY=($(compgen -W 'IPv4 IPv6 none' -- "$cur"))
+ _comp_compgen -- -W 'IPv4 IPv6 none'
return
;;
- --directory-prefix | --ca-directory | --warc-tempdir | -!(-*)P)
- _filedir -d
+ --directory-prefix | --ca-directory | --warc-tempdir | -${noargopts}P)
+ _comp_compgen_filedir -d
return
;;
- --output-file | --append-output | --config | --load-cookies | --save-cookies | \
- --post-file | --certificate | --ca-certificate | --private-key | \
- --random-file | --egd-file | --warc-file | --warc-dedup | -!(-*)[oa])
- _filedir
+ --output-file | --append-output | --config | --load-cookies | \
+ --save-cookies | --post-file | --certificate | --ca-certificate | \
+ --private-key | --random-file | --egd-file | --warc-file | \
+ --warc-dedup | -${noargopts}[oa])
+ _comp_compgen_filedir
return
;;
- --output-document | --input-file | -!(-*)[Oi])
- _filedir && [[ $cur == - || -z $cur ]] && COMPREPLY+=(-)
+ --output-document | --input-file | -${noargopts}[Oi])
+ _comp_compgen_filedir && [[ $cur == - || ! $cur ]] && COMPREPLY+=(-)
return
;;
--secure-protocol)
- COMPREPLY=($(compgen -W 'auto SSLv2 SSLv3 TLSv1' -- "$cur"))
+ _comp_compgen -- -W 'auto SSLv2 SSLv3 TLSv1'
return
;;
--certificate-type | --private-key-type)
- COMPREPLY=($(compgen -W 'PEM DER' -- "$cur"))
+ _comp_compgen -- -W 'PEM DER'
return
;;
--follow-tags | --ignore-tags)
local lastopt=${cur/*,/} prevopt=
[[ $cur == *,* ]] && prevopt=${cur%,*},
- COMPREPLY=($(compgen -P "$prevopt" -W 'a abbr acronym address
- applet area b base basefont bdo big blockquote body br button
- caption center cite code col colgroup dd del dir div dfn dl dt
- em fieldset font form frame frameset h6 head hr html i iframe
- img input ins isindex kbd label legend li link map menu meta
- noframes noscript object ol optgroup option p param pre q s
- samp script select small span strike strong style sub sup table
- tbody td textarea tfoot th thead title tr tt u ul var xmp' \
- -- "$lastopt"))
- return
- ;;
- --tries | --timeout | --dns-timeout | --connect-timeout | --read-timeout | \
- --wait | --waitretry | --cut-dirs | --max-redirect | --level | -!(-*)[tTwl])
+ _comp_compgen -c "$lastopt" -- -P "$prevopt" -W 'a abbr acronym
+ address applet area b base basefont bdo big blockquote body br
+ button caption center cite code col colgroup dd del dir div dfn
+ dl dt em fieldset font form frame frameset h6 head hr html i
+ iframe img input ins isindex kbd label legend li link map menu
+ meta noframes noscript object ol optgroup option p param pre q
+ s samp script select small span strike strong style sub sup
+ table tbody td textarea tfoot th thead title tr tt u ul var
+ xmp'
+ return
+ ;;
+ --tries | --timeout | --dns-timeout | --connect-timeout | \
+ --read-timeout | --wait | --waitretry | --cut-dirs | \
+ --max-redirect | --level | -${noargopts}[tTwl])
# expect integer number
- COMPREPLY+=($(compgen -P "$cur" -W "{0..9}"))
+ _comp_compgen -aR -- -P "$cur" -W "{0..9}"
compopt -o nospace
return
;;
- --quota | --limit-rate | --warc-max-size | -!(-*)Q)
+ --quota | --limit-rate | --warc-max-size | -${noargopts}Q)
# expect size
if [[ $cur == *[km] ]]; then
- COMPREPLY=($(compgen -W "$cur"))
+ _comp_compgen -R -- -W "$cur"
elif [[ $cur ]]; then
- COMPREPLY=($(compgen -P "$cur" -W "{0..9} k m"))
+ _comp_compgen -R -- -P "$cur" -W "{0..9} k m"
compopt -o nospace
else
- COMPREPLY=($(compgen -W "{0..9}"))
+ _comp_compgen -R -- -W "{0..9}"
compopt -o nospace
fi
return
;;
--user | --http-user | --proxy-user | --ftp-user)
- COMPREPLY=($(compgen -W "$(command sed -n \
+ _comp_compgen_split -- "$(command sed -n \
'/^login/s/^[[:blank:]]*login[[:blank:]]//p' ~/.netrc \
- 2>/dev/null)" -- "$cur"))
+ 2>/dev/null)"
return
;;
--header)
- COMPREPLY=($(compgen -W 'Accept Accept-Charset Accept-Encoding
+ _comp_compgen -- -W 'Accept Accept-Charset Accept-Encoding
Accept-Language Accept-Ranges Age Allow Authorization
Cache-Control Connection Content-Encoding Content-Language
Content-Length Content-Location Content-MD5 Content-Range
@@ -133,42 +138,43 @@ _wget()
Last-Modified Location Max-Forwards Pragma Proxy-Authenticate
Proxy-Authorization Range Referer Retry-After Server TE Trailer
Transfer-Encoding Upgrade User-Agent Vary Via Warning
- WWW-Authenticate' -- "$cur"))
+ WWW-Authenticate'
compopt -o nospace
return
;;
--local-encoding | --remote-encoding)
- type -P xauth &>/dev/null && _xfunc iconv _iconv_charsets
+ type -P xauth &>/dev/null && _comp_compgen -x iconv charsets
return
;;
- --execute | -!(-*)e)
+ --execute | -${noargopts}e)
return # TODO base=STR
;;
--report-speed)
- COMPREPLY=($(compgen -W 'bits' -- "$cur"))
+ _comp_compgen -- -W 'bits'
return
;;
--regex-type)
- COMPREPLY=($(compgen -W 'posix' -- "$cur"))
+ _comp_compgen -- -W 'posix'
return
;;
- --base | --password | --ftp-password | --http-password | --proxy-password | \
- --default-page | --referer | --user-agent | --post-data | --warc-header | \
- --accept | --reject | --accept-regex | --reject-regex | --include-directories | \
- --exclude-directories | -!(-*)[BUARIX])
+ --base | --password | --ftp-password | --http-password | \
+ --proxy-password | --default-page | --referer | --user-agent | \
+ --post-data | --warc-header | --accept | --reject | \
+ --accept-regex | --reject-regex | --include-directories | \
+ --exclude-directories | -${noargopts}[BUARIX])
# argument required but no completions available
return
;;
esac
- $split && return
+ [[ $was_split ]] && return
if [[ $cur == -* ]]; then
- COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur"))
+ _comp_compgen_help
[[ ${COMPREPLY-} == *= ]] && compopt -o nospace
fi
} &&
- complete -F _wget wget
+ complete -F _comp_cmd_wget wget
# ex: filetype=sh