-
Notifications
You must be signed in to change notification settings - Fork 1
/
tab-complete.sh
executable file
·58 lines (51 loc) · 1.19 KB
/
tab-complete.sh
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
# Tab completion for vcamp.h
_vcamp_tab_complete ()
{
local curr prev
COMPREPLY=()
curr=${COMP_WORDS[COMP_CWORD]}
prev=${COMP_WORDS[COMP_CWORD-1]}
case "$curr" in
*)
local opts="create remove restore"
COMPREPLY=( $( compgen -W "${opts}" ${curr} ) )
;;
esac
case "$prev" in
create)
# case $curr in
# *)
local subopts="default -n -d -p -e -g -b -i \
--name --dest --part --efi --guest --bit32 --icns"
COMPREPLY=( $( compgen -W "${subopts}" -- ${curr} ) )
;;
# esac
# ;;
remove)
case $curr in
*)
local subopts="default -n -d -p --name --dest --part"
COMPREPLY=( $( compgen -W "${subopts}" -- ${curr} ) )
;;
esac
;;
restore)
case $curr in
*)
local subopts="-p --part"
COMPREPLY=( $( compgen -W "${subopts}" -- ${curr} ) )
;;
esac
;;
-d|--dest|-p|--part)
COMPREPLY=( $(compgen -A directory))
return 0
;;
default|-e|--efi|-g|--guest|-n|--name)
COMPREPLY=()
return 0
;;
esac
return 0
}
complete -F _vcamp_tab_complete -o filenames ./vcamp.sh