summaryrefslogtreecommitdiffstats
path: root/completions/slapt-src
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
commitf4acb49ea148cdd899f7f29f1591c7bc853c2135 (patch)
treeb62d60873864065d6428a84a119dd8a3c90f1397 /completions/slapt-src
parentAdding upstream version 1:2.11. (diff)
downloadbash-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/slapt-src')
-rw-r--r--completions/slapt-src36
1 files changed, 21 insertions, 15 deletions
diff --git a/completions/slapt-src b/completions/slapt-src
index 1e3828c..cdf00c2 100644
--- a/completions/slapt-src
+++ b/completions/slapt-src
@@ -1,13 +1,13 @@
# slapt-src(8) completion -*- shell-script -*-
-_slapt_src()
+_comp_cmd_slapt_src()
{
- local cur prev words cword split
- _init_completion -s -n : || return
+ local cur prev words cword was_split comp_args
+ _comp_initialize -s -n : -- "$@" || return
case "$prev" in
--config | -c)
- _filedir
+ _comp_compgen_filedir
return
;;
--search | -s | --postprocess | -p)
@@ -16,17 +16,17 @@ _slapt_src()
;;
esac
- $split && return
+ [[ $was_split ]] && return
if [[ $cur == -* ]]; then
- COMPREPLY=($(compgen -W '$(_parse_help "$1" --help)' -- "$cur"))
+ _comp_compgen_help
if [[ ${COMPREPLY-} ]]; then
[[ $COMPREPLY == *= ]] && compopt -o nospace
return
fi
fi
- local i t
+ local i t=""
# search for last action (-i|-w|-b|-f)
for ((i = ${#words[@]} - 1; i > 0; i--)); do
if [[ ${words[i]} == -@([iwfb]|-install|-show|-build|-fetch) ]]; then
@@ -42,8 +42,9 @@ _slapt_src()
# 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
if [[ ${words[i]} == --config=?* ]]; then
@@ -55,14 +56,19 @@ _slapt_src()
if [[ $cur == *:* ]]; then
local name=${cur%:*}
- COMPREPLY=($(LC_ALL=C "$1" --config "$config" --search "^$name" \
- 2>/dev/null | LC_ALL=C command sed -ne \
- "/^$cur/{s/^$name:\([^ ]*\) .*$/\1/;p}"))
+ _comp_compgen_split -l -- "$(
+ LC_ALL=C
+ "$1" --config "$config" --search "^$name" 2>/dev/null |
+ command sed -ne "/^$cur/{s/^$name:\([^ ]*\) .*$/\1/;p;}"
+ )"
else
- COMPREPLY=($(LC_ALL=C "$1" --config "$config" --search "^$cur" \
- 2>/dev/null | LC_ALL=C command sed -ne "/^$cur/{s/ .*$//;p}"))
+ _comp_compgen_split -l -- "$(
+ LC_ALL=C
+ "$1" --config "$config" --search "^$cur" 2>/dev/null |
+ command sed -ne "/^$cur/{s/ .*$//;p;}"
+ )"
fi
} &&
- complete -F _slapt_src slapt-src
+ complete -F _comp_cmd_slapt_src slapt-src
# ex: filetype=sh