blob: 9eb873d6352caeb5821a29f52066103c662e24b2 (
plain) (
blame)
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
|
_clm()
{
local cur prev opts
COMPRREPLY=()
cur="${COMP_WORDS[COMP_CWORD]}"
prev="${COMP_WORDS[COMP_CWORD-1]}"
opts="-I -IL -P -w -nw -d -nd -sa -nsa -mv -ms -O -PO -S -PS -ABC -PABC -c -lt -nlt -lat -nlat -lset -ci -nci -ou -nou -fusion -nfusion -pt -npt -desc -exl -tst -funcmayfail -varnotused -funcnotused -nowarn -ns -no-opt-link -l -sl -e -E -aC -h -s -b -sc -t -nt -gc -ngc -st -nst -nr -gcm -gcc -gcf -gci -dynamics -nortsopts -p -pic -optabc -bytecode"
case $prev in
"-IL")
# Complete Clean libraries
opts="$(find "$CLEAN_HOME/lib" -mindepth 1 -maxdepth 1 -type d -exec basename {} \;)"
COMPREPLY=($(compgen -W "$opts" -- $cur))
return 0
;;
"-I")
# Complete directories
_filedir
for index in "${!COMPREPLY[@]}"; do
[ -d "${COMPREPLY[index]}" ] || unset -v 'COMPREPLY[$index]'
done
return 0
;;
"-l" | "-sl")
# Complete files
_filedir
for index in "${!COMPREPLY[@]}"; do
[ -f "${COMPREPLY[index]}" ] || unset -v 'COMPREPLY[$index]'
done
return 0
;;
"-P" | "-e" | "-E" | "-h" | "-s" | "-gcf" | "-gci")
# Complete nothing
return 0
;;
esac
if [[ $cur == -* ]]; then
# Complete options
COMPREPLY=($(compgen -W "$opts" -- $cur))
return 0
else
# Main module; complete icl module names
opts="$(find -name '*.icl' -maxdepth 4 -type f -print 2>/dev/null | sed 's:^\./::;s:/:.:g;s:\.icl$::' | grep -v '[- ]')"
COMPREPLY=($(compgen -W "$opts" -- $cur))
return 0
fi
}
complete -F _clm clm
|