Repository navigation
Expand file tree
/
Copy pathkgit-completion.bash
More file actions
68 lines (63 loc) · 1.82 KB
/
Copy pathkgit-completion.bash
File metadata and controls
68 lines (63 loc) · 1.82 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
_kgit()
{
local cur prev opts offset i
_get_comp_words_by_ref cur prev
offset=0
for (( i=1; i <= COMP_CWORD; i++ )); do
# check if we're still completing our options
case ${COMP_WORDS[$i]} in
gh|git|hub|glab)
offset=$((i+1))
offset=$i
break
;;
esac
done
if [ $offset -gt 0 ]; then
# echo
# echo "offset is '$offset'"
# echo "cur is '$cur'"
# echo "prev is '$prev'"
# echo "COMP_WORDS '${COMP_WORDS[*]}'"
# echo "length of COMP_WORDS '${#COMP_WORDS[@]}'"
# echo "word at offset is '${COMP_WORDS[$offset]}'"
# echo
_command_offset $offset
else
COMPREPLY=()
opts="
-kapps
-exclude-apps
-a -all-apps
-A -all
-kcore
-kroot
-kchanged
-help
-q -qq
-get-root
-exit-on-error
gh
git
glab
hub"
case "${prev}" in
-kapps)
if [ -d "applications" ]; then
COMPREPLY=( $(compgen -W "$(echo applications/*/ | sed -e 's/applications//g' -e 's|/||g')" -- "$cur") )
else
COMPREPLY=( $(compgen -W "blackhole braintree callflow call_inspector cdr conference crossbar doodle \
ecallmgr fax hangups hotornot jonny5 media_mgr milliwatt omnipresence pivot pusher registrar reorder \
skel stats stepswitch sysconf tasks teletype trunkstore webhooks" -- "$cur") )
fi
return
;;
-kzchanged)
return
;;
esac
COMPREPLY=( $(compgen -W "${opts}" -- "$cur") )
return
fi
} &&
complete -F _kgit kgit