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 | f2621414ee5f2f601424c22f00e207903e3b6104 (patch) | |
tree | 56a856dafd1ca684bb23263cacaa723ee4f404fc /completions/slapt-get | |
parent | Adding debian version 1:2.11-8. (diff) | |
download | bash-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 '')
-rw-r--r-- | completions/slapt-get | 40 |
1 files changed, 21 insertions, 19 deletions
diff --git a/completions/slapt-get b/completions/slapt-get index 14c2dbe..1dc09e0 100644 --- a/completions/slapt-get +++ b/completions/slapt-get @@ -1,13 +1,13 @@ # slapt-get(8) completion -*- shell-script -*- -_slapt_get() +_comp_cmd_slapt_get() { - local cur prev words cword - _init_completion || return + local cur prev words cword comp_args + _comp_initialize -- "$@" || return case "$prev" in --config | -c) - _filedir + _comp_compgen_filedir return ;; --retry | --search) @@ -17,7 +17,7 @@ _slapt_get() esac if [[ $cur == -* ]]; then - COMPREPLY=($(compgen -W '$(_parse_help "$1" --help)' -- "$cur")) + _comp_compgen_help if [[ ${COMPREPLY-} ]]; then [[ $COMPREPLY == *= ]] && compopt -o nospace return @@ -25,7 +25,8 @@ _slapt_get() fi local i t - # search for last action (--install|--install-set|--remove|--show|--filelist) + # search for last action + # (--install|--install-set|--remove|--show|--filelist) for ((i = ${#words[@]} - 1; i > 0; i--)); do if [[ ${words[i]} == --show ]]; then t="all" @@ -46,8 +47,9 @@ _slapt_get() # search for config for ((i = ${#words[@]} - 1; i > 0; i--)); do if [[ ${words[i]} == -@(c|-config) ]]; then - config="${words[i + 1]}" - __expand_tilde_by_ref config + local REPLY + _comp_expand_tilde "${words[i + 1]-}" + config=$REPLY break fi done @@ -58,29 +60,29 @@ _slapt_get() # slapt-get will fail to search for "^name-version" # it can search for names only local name=${cur%%-*} - COMPREPLY=($(LC_ALL=C "$1" -c "$config" --search "^$name" \ - 2>/dev/null | LC_ALL=C command sed -ne "/^$cur/{s/ .*$//;p}")) + _comp_compgen_split -l -- "$( + LC_ALL=C "$1" -c "$config" --search "^$name" 2>/dev/null | + LC_ALL=C command sed -ne "/^$cur/{s/ .*$//;p;}" + )" return ;; avl) # --install|-i| - COMPREPLY=($(LC_ALL=C "$1" -c "$config" --available \ - 2>/dev/null | LC_ALL=C command sed -ne "/^$cur/{s/ .*$//;p}")) + _comp_compgen_split -l -- "$( + LC_ALL=C "$1" -c "$config" --available 2>/dev/null | + LC_ALL=C command sed -ne "/^$cur/{s/ .*$//;p;}" + )" return ;; ins) # --remove|--filelist - COMPREPLY=($( - cd /var/log/packages - compgen -f -- "$cur" - )) + _comp_compgen -C /var/log/packages -- -f return ;; set) # --install-set - COMPREPLY=($(compgen -W 'a ap d e f k kde kdei l n t tcl x - xap xfce y' -- "$cur")) + _comp_compgen -- -W 'a ap d e f k kde kdei l n t tcl x xap xfce y' return ;; esac } && - complete -F _slapt_get slapt-get + complete -F _comp_cmd_slapt_get slapt-get # ex: filetype=sh |