source: main/trunk/gs-release-builder/envi/setup.sh@ 36214

Last change on this file since 36214 was 36212, checked in by kjdon, 2 years ago

a new repository for greenstone release build system files

File size: 1.2 KB
Line 
1if [ "`uname -sr|sed s/\\\\..*//`" == "Darwin 8" ]; then
2 if [ "$1" == "" ]; then
3 echo "Under MacOS Tiger and earlier you must source setup.sh like this:"
4 echo "source /path/to/envi/setup.sh /path/to/envi"
5 return
6 fi
7 home="$1"
8else
9 home="`dirname ${BASH_SOURCE[0]}`"
10fi
11
12export PATH="`$home/bin/envi home`/bin:$PATH"
13
14function envi_complete {
15 local cur prev words first_arg second_arg
16
17 COMPREPLY=()
18
19 cur="${COMP_WORDS[COMP_CWORD]}"
20 prev="${COMP_WORDS[COMP_CWORD-1]}"
21
22 #figure out if the first (real) arg has been given
23 for (( i = 1 ; i < ${#COMP_WORDS[@]}-1 ; i++ )); do
24 word=${COMP_WORDS[$i]}
25 if [[ ${word} != -* ]] ; then
26 if [ "$first_arg" == "" ]; then
27 first_arg=$word
28 elif [ "$second_arg" == "" ]; then
29 second_arg=$word
30 else
31 break
32 fi
33 fi
34 done
35
36 #complete first arg
37 if [ "$first_arg" == "" ]; then
38 completes="`envi playlists` `envi tasks` home tasks playlists env"
39 #complete second arg
40 #elif [ "$first_arg" != "" ] && [ "$second_arg" == "" ]; then
41 # completes="`envi $first_arg options` env options"
42 #cant help complete third arg
43 else
44 completes=""
45 fi
46
47 COMPREPLY=( $(compgen -W "${completes}" -- ${cur}))
48 return 0
49}
50complete -F envi_complete envi
51
Note: See TracBrowser for help on using the repository browser.