From f2621414ee5f2f601424c22f00e207903e3b6104 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sat, 4 May 2024 03:03:18 +0200 Subject: Merging upstream version 1:2.12.0. Signed-off-by: Daniel Baumann --- completions/slapt-get | 40 +++++++++++++++++++++------------------- 1 file changed, 21 insertions(+), 19 deletions(-) (limited to 'completions/slapt-get') 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 -- cgit v1.2.3