-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gittool-completion.bash
50 lines (45 loc) · 1.81 KB
/
.gittool-completion.bash
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
#!/bin/bash
_gitkeep()
{
local current options
COMPREPLY=()
current="${COMP_WORDS[COMP_CWORD]}"
options=("forward_merge clean setup")
case "${COMP_WORDS[1]}" in
forward_merge)
if [ "${COMP_WORDS[COMP_CWORD-1]}" == "--base_branch" ] ; then
local running=$(for x in `./gitkeep forward_merge --output_local`; do echo ${x} ; done)
COMPREPLY=( $(compgen -W "${running}" -- ${current}) )
elif [ "${COMP_WORDS[COMP_CWORD-1]}" == "--merge_branch" ] ; then
local running=$(for x in `./gitkeep forward_merge --output_remote`; do echo ${x} ; done)
COMPREPLY=( $(compgen -W "${running}" -- ${current}) )
else
local running=$(for x in `./gitkeep forward_merge -c`; do echo ${x} ; done)
COMPREPLY=( $(compgen -W "${running}" -- ${current}) )
fi
return 0
;;
clean)
if [ "${COMP_WORDS[COMP_CWORD-1]}" == "--base_branch" ] ; then
local running=$(for x in `./gitkeep clean --output_local`; do echo ${x} ; done)
COMPREPLY=( $(compgen -W "${running}" -- ${current}) )
elif [ "${COMP_WORDS[COMP_CWORD-1]}" == "--merge_branch" ] ; then
local running=$(for x in `./gitkeep clean --output_remote`; do echo ${x} ; done)
COMPREPLY=( $(compgen -W "${running}" -- ${current}) )
else
local running=$(for x in `./gitkeep clean -c`; do echo ${x} ; done)
COMPREPLY=( $(compgen -W "${running}" -- ${current}) )
fi
return 0
;;
setup)
return 0
;;
*)
;;
esac
COMPREPLY=( $(compgen -W "${options}" ${current}) )
return 0
}
echo "loaded git script"
complete -F _gitkeep gitkeep