diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-04 01:03:19 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-04 01:03:19 +0000 |
commit | 6c09f2a45c5541e9c207d14fc7aa21a4a0066bde (patch) | |
tree | 0221189d367bf661f6f9493c4f17a03f0dd4b7d2 /completions/xz | |
parent | Releasing progress-linux version 1:2.11-8~progress7.99u1. (diff) | |
download | bash-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/xz')
-rw-r--r-- | completions/xz | 43 |
1 files changed, 23 insertions, 20 deletions
diff --git a/completions/xz b/completions/xz index 73958c5..8d6c53b 100644 --- a/completions/xz +++ b/completions/xz @@ -1,56 +1,59 @@ # xz(1) completion -*- shell-script -*- -_xz() +_comp_cmd_xz() { - local cur prev words cword split - _init_completion -s || return + local cur prev words cword was_split comp_args + _comp_initialize -s -- "$@" || return local xspec="*.@(xz|lzma|txz|tlz)" + local noargopts='!(-*|*[CFTMS]*)' + # shellcheck disable=SC2254 case $prev in - --decompress | --list | --test | -!(-*)[dlt]*) + --decompress | --list | --test | -${noargopts}[dlt]*) xspec="!"$xspec ;; --files | --files0) - _filedir + _comp_compgen_filedir return ;; - --check | -!(-*)C) - COMPREPLY=($(compgen -W 'crc32 crc64 sha256 none' -- "$cur")) + --check | -${noargopts}C) + _comp_compgen -- -W 'crc32 crc64 sha256 none' return ;; - --format | -!(-*)F) - COMPREPLY=($(compgen -W 'auto xz lzma raw' -- "$cur")) + --format | -${noargopts}F) + _comp_compgen -- -W 'auto xz lzma raw' return ;; - --threads | -!(-*)T) - COMPREPLY=($(compgen -W "{0..$(_ncpus)}" -- "$cur")) + --threads | -${noargopts}T) + local REPLY + _comp_get_ncpus + _comp_compgen -- -W "{0..$REPLY}" return ;; --memlimit | --memlimit-compress | --memlimit-decompress | --memory | \ - --suffix | --delta | --lzma1 | --lzma2 | -!(-*)[MS]) + --suffix | --delta | --lzma1 | --lzma2 | -${noargopts}[MS]) return ;; - --help | --long-help | --version | --info-memory | -!(-*)[hHV]) + --help | --long-help | --version | --info-memory | -${noargopts}[hHV]) return ;; esac - $split && return + [[ $was_split ]] && return if [[ $cur == -* ]]; then - COMPREPLY=($(compgen -W '$(_parse_help "$1" --long-help) {-1..-9}' \ - -- "$cur")) + _comp_compgen_help -- --long-help + _comp_compgen -a -- -W '{-1..-9}' [[ ${COMPREPLY-} == *= ]] && compopt -o nospace return fi - _tilde "$cur" || return + _comp_compgen_tilde && return - local IFS=$'\n' compopt -o filenames - COMPREPLY=($(compgen -f -X "$xspec" -- "$cur") $(compgen -d -- "$cur")) + _comp_compgen -- -f -X "$xspec" -o plusdirs } && - complete -F _xz xz pxz + complete -F _comp_cmd_xz xz pxz # ex: filetype=sh |