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/strings | |
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/strings')
-rw-r--r-- | completions/strings | 41 |
1 files changed, 23 insertions, 18 deletions
diff --git a/completions/strings b/completions/strings index 059f557..45f0e60 100644 --- a/completions/strings +++ b/completions/strings @@ -1,45 +1,50 @@ # strings(1) completion -*- shell-script -*- -_strings() +_comp_cmd_strings() { - 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='!(-*|*[nstTe]*)' + # shellcheck disable=SC2254 case $prev in - --help | --version | --bytes | -!(-*)[hvVn]) + --help | --version | --bytes | --output-separator | -arch | \ + -${noargopts}[hvVns]) return ;; - --radix | -!(-*)t) - COMPREPLY=($(compgen -W 'o d x' -- "$cur")) + --radix | -${noargopts}t) + _comp_compgen -- -W 'o d x' return ;; - --target | -!(-*)T) - COMPREPLY=($(compgen -W '$(LC_ALL=C "$1" --help 2>/dev/null | \ - command sed -ne "s/: supported targets: \(.*\)/\1/p")' \ - -- "$cur")) + --target | -${noargopts}T) + _comp_compgen_split -- "$(LC_ALL=C "$1" --help 2>/dev/null | + command sed -ne 's/: supported targets: \(.*\)/\1/p')" return ;; - --encoding | -!(-*)e) - COMPREPLY=($(compgen -W 's S b l B L' -- "$cur")) + --encoding | -${noargopts}e) + _comp_compgen_split -F , -- "$(LC_ALL=C "$1" --help 2>/dev/null | + command sed -ne 's/.*--encoding={\([^}]*\)}.*/\1/p')" return ;; esac - $split && return + [[ $was_split ]] && return if [[ $cur == -* ]]; then - COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur")) + # macOS: ... [-t format] [-number] [-n number] ... + _comp_compgen_help || + _comp_compgen_usage - <<<"$("$1" --help 2>&1 | + command sed -e "s/\[-number\]//")" [[ ${COMPREPLY-} == *= ]] && compopt -o nospace return elif [[ $cur == @* ]]; then - cur=${cur:1} - _filedir + _comp_compgen -c "${cur:1}" filedir COMPREPLY=("${COMPREPLY[@]/#/@}") return fi - _filedir + _comp_compgen_filedir } && - complete -F _strings strings + complete -F _comp_cmd_strings strings # ex: filetype=sh |