summaryrefslogtreecommitdiffstats
path: root/completions/slapt-src
diff options
context:
space:
mode:
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