summaryrefslogtreecommitdiffstats
path: root/completions/strings
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
commitf2621414ee5f2f601424c22f00e207903e3b6104 (patch)
tree56a856dafd1ca684bb23263cacaa723ee4f404fc /completions/strings
parentAdding debian version 1:2.11-8. (diff)
downloadbash-completion-f2621414ee5f2f601424c22f00e207903e3b6104.tar.xz
bash-completion-f2621414ee5f2f601424c22f00e207903e3b6104.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/strings41
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