diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-04 01:03:18 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-04 01:03:18 +0000 |
commit | f4acb49ea148cdd899f7f29f1591c7bc853c2135 (patch) | |
tree | b62d60873864065d6428a84a119dd8a3c90f1397 /completions/iconv | |
parent | Adding upstream version 1:2.11. (diff) | |
download | bash-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/iconv')
-rw-r--r-- | completions/iconv | 40 |
1 files changed, 27 insertions, 13 deletions
diff --git a/completions/iconv b/completions/iconv index 81ae01b..bbcbbdd 100644 --- a/completions/iconv +++ b/completions/iconv @@ -1,38 +1,52 @@ # iconv(1) completion -*- shell-script -*- +# @since 2.12 +_comp_xfunc_iconv_compgen_charsets() +{ + _comp_cmd_iconv__compgen_charsets iconv +} + +# @deprecated 2.12 use `_comp_xfunc_iconv_compgen_charsets` instead _iconv_charsets() { - COMPREPLY+=($(compgen -X ... -W '$(${1:-iconv} -l | \ - command sed -e "s@/*\$@@" -e "s/[,()]//g")' -- "$cur")) + _comp_compgen -ai iconv charsets "${1:-iconv}" +} + +_comp_cmd_iconv__compgen_charsets() +{ + _comp_compgen_split -X ... -- "$("$1" -l | + command sed -e 's@/*$@@' -e 's/[,()]//g')" } -_iconv() +_comp_cmd_iconv() { - 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='!(-*|*[fto]*)' + # shellcheck disable=SC2254 case $prev in --help | --usage | --version | --unicode-subst | --byte-subst | \ - --widechar-subst | -!(-*)[?V]) + --widechar-subst | -${noargopts}[?V]) return ;; - --from-code | --to-code | -!(-*)[ft]) - _iconv_charsets $1 + --from-code | --to-code | -${noargopts}[ft]) + _comp_cmd_iconv__compgen_charsets "$1" return ;; - --output | -!(-*)o) - _filedir + --output | -${noargopts}o) + _comp_compgen_filedir 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 _iconv -o default iconv + complete -F _comp_cmd_iconv -o default iconv # ex: filetype=sh |