This repository has been archived by the owner on Aug 11, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 26
/
bash-complete
66 lines (64 loc) · 2 KB
/
bash-complete
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
OPTS='-h -v -x'
COMMANDS='help version extract install update new tests info repl'
NEW='script library service yaws presentation'
INSTALL='lfetool autocomplete lfe erlang kerl rebar relx expm erjang'
YAWS='default bootstrap'
TESTS='build unit integration system all'
UPDATE='lfetool deps'
INFO='version erllibs path installdir bindir'
REPL='lfe erlang jlfe jerl'
_get-lfetool-opts-and-commands () {
local cur prev # current and previous completion word
COMPREPLY=() # array for possible completions
cur=${COMP_WORDS[COMP_CWORD]}
prev=${COMP_WORDS[COMP_CWORD-1]}
case "$cur" in
-*)
COMPREPLY=($(compgen -W "${OPTS}" -- $cur))
;;
*)
COMPREPLY=($(compgen -W "${COMMANDS} ${OPTS}" -- $cur))
;;
esac
case "$prev" in
install)
COMPREPLY=($(compgen -W "${INSTALL}" -- $cur))
;;
new)
COMPREPLY=($(compgen -W "${NEW}" -- $cur))
;;
yaws)
COMPREPLY=($(compgen -W "${YAWS}" -- $cur))
;;
tests)
COMPREPLY=($(compgen -W "${TESTS}" -- $cur))
;;
update)
COMPREPLY=($(compgen -W "${UPDATE}" -- $cur))
;;
info)
COMPREPLY=($(compgen -W "${INFO}" -- $cur))
;;
repl)
COMPREPLY=($(compgen -W "${REPL}" -- $cur))
;;
# no more tab-completion for these ...
# XXX there has *got* to be a nicer way to do this; we want to have no
# TAB-completion for *any* of the final commands ...
help)
COMPREPLY=($(compgen -W "" -- $cur))
;;
version)
COMPREPLY=($(compgen -W "" -- $cur))
;;
extract)
COMPREPLY=($(compgen -W "" -- $cur))
;;
-*)
COMPREPLY=($(compgen -W "" -- $cur))
;;
esac
return 0
}
complete -F _get-lfetool-opts-and-commands \
-o filenames `which lfetool` lfetool ./lfetool