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/aspell | |
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/aspell')
-rw-r--r-- | completions/aspell | 57 |
1 files changed, 29 insertions, 28 deletions
diff --git a/completions/aspell b/completions/aspell index e080a07..89dae17 100644 --- a/completions/aspell +++ b/completions/aspell @@ -1,65 +1,66 @@ # bash completion for aspell -*- shell-script -*- -_aspell_dictionary() +_comp_cmd_aspell__dictionary() { - local datadir aspell=${1:-aspell} - datadir=$($aspell config data-dir 2>/dev/null || echo /usr/lib/aspell) + local datadir aspell=$1 + datadir=$("$aspell" config data-dir 2>/dev/null || echo /usr/lib/aspell) # First, get aliases (dicts dump does not list them) - COMPREPLY=($(printf '%s\n' $datadir/*.alias)) - COMPREPLY=("${COMPREPLY[@]%.alias}") - COMPREPLY=("${COMPREPLY[@]#$datadir/}") + if _comp_expand_glob COMPREPLY '"$datadir"/*.alias'; then + COMPREPLY=("${COMPREPLY[@]%.alias}") + COMPREPLY=("${COMPREPLY[@]#$datadir/}") + fi # Then, add the canonical dicts - COMPREPLY+=($($aspell dicts 2>/dev/null)) - COMPREPLY=($(compgen -X '\*' -W '${COMPREPLY[@]}' -- "$cur")) + _comp_split -a COMPREPLY "$("$aspell" dicts 2>/dev/null)" + ((${#COMPREPLY[@]})) && + _comp_compgen -- -X '\*' -W '"${COMPREPLY[@]}"' } -_aspell() +_comp_cmd_aspell() { - local cur prev words cword split - _init_completion -s || return + local cur prev words cword was_split comp_args + _comp_initialize -s -- "$@" || return case $prev in -c | -p | check | --conf | --personal | --repl | --per-conf) - _filedir + _comp_compgen_filedir return ;; --conf-dir | --data-dir | --dict-dir | --home-dir | --local-data-dir | --prefix) - _filedir -d + _comp_compgen_filedir -d return ;; dump | create | merge) - COMPREPLY=($(compgen -W 'master personal repl' -- "$cur")) + _comp_compgen -- -W 'master personal repl' return ;; --mode) - COMPREPLY=($(compgen -W "$($1 modes 2>/dev/null | - awk '{ print $1 }')" -- "$cur")) + _comp_compgen_split -- "$("$1" modes 2>/dev/null | + _comp_awk '{ print $1 }')" return ;; --sug-mode) - COMPREPLY=($(compgen -W 'ultra fast normal bad-speller' \ - -- "$cur")) + _comp_compgen -- -W 'ultra fast normal bad-speller' return ;; --keymapping) - COMPREPLY=($(compgen -W 'aspell ispell' -- "$cur")) + _comp_compgen -- -W 'aspell ispell' return ;; -d | --master) - _aspell_dictionary "$1" + _comp_cmd_aspell__dictionary "$1" return ;; --add-filter | --rem-filter) - COMPREPLY=($(compgen -W "$($1 filters 2>/dev/null | - awk '{ print $1 }')" -- "$cur")) + _comp_compgen_split -- "$("$1" filters 2>/dev/null | + _comp_awk '{ print $1 }')" return ;; esac - $split && return + [[ $was_split ]] && return if [[ $cur == -* ]]; then - COMPREPLY=($(compgen -W '--conf= --conf-dir= --data-dir= --dict-dir= + _comp_compgen -- -W '--conf= --conf-dir= --data-dir= --dict-dir= --encoding= --add-filter= --rem-filter= --mode= --add-extra-dicts= --rem-extra-dicts= --home-dir= --ignore= --ignore-accents --dont-ignore-accents --ignore-case --dont-ignore-case @@ -76,13 +77,13 @@ _aspell() --add-tex-command= --rem-tex-command= --tex-check-comments --dont-tex-check-comments --add-tex-extension --rem-tex-extension --add-sgml-check= --rem-sgml-check= --add-sgml-extension - --rem-sgml-extension' -- "$cur")) + --rem-sgml-extension' [[ ${COMPREPLY-} == *= ]] && compopt -o nospace else - COMPREPLY=($(compgen -W 'usage help check pipe list config soundslike - filter version dump create merge' -- "$cur")) + _comp_compgen -- -W 'usage help check pipe list config soundslike + filter version dump create merge' fi } && - complete -F _aspell aspell + complete -F _comp_cmd_aspell aspell # ex: filetype=sh |