forked from dfki-ric/docker_image_development
-
Notifications
You must be signed in to change notification settings - Fork 1
/
autocomplete.me
51 lines (42 loc) · 1.87 KB
/
autocomplete.me
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
#!/bin/bash
ROOT_DIR=$(cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
export PATH=$ROOT_DIR${PATH:+:${PATH}}
_exec_bash(){
local cur prev words cword package
cur=${COMP_WORDS[COMP_CWORD]}
if [ "${COMP_WORDS[1]}" = "storedrelease" ]; then
# nothing comes after release
if [ "${#COMP_WORDS[@]}" -gt "4" ]; then
return
fi
if [ "${#COMP_WORDS[@]}" -gt "3" ]; then
COMPREPLY=($(compgen -W "$(ls startscripts | xargs) /bin/bash" -- "$cur"))
return
fi
# omit the first line
STORED_RELEASES=$(tail -n +2 .stored_images.txt | grep = | cut -d '=' -f 1)
COMPREPLY=($(compgen -W "${STORED_RELEASES}" -- "$cur"))
return
fi
if [ "${COMP_WORDS[1]}" = "00_start_rock_runtime.bash" ] ||
[ "${COMP_WORDS[1]}" = "01_start_simulation.bash" ] ||
[ "${COMP_WORDS[1]}" = "start_simulation.bash" ] ||
[ "${COMP_WORDS[2]}" = "00_start_rock_runtime.bash" ] ||
[ "${COMP_WORDS[2]}" = "01_start_simulation.bash" ] ||
[ "${COMP_WORDS[2]}" = "start_simulation.bash" ]; then
# omit the first line
COMPREPLY=($(compgen -W "coyote3 sherpa_tt aruco moon maguez corobx" -- "$cur"))
return
fi
if [ "${#COMP_WORDS[@]}" -gt "2" ]; then
COMPREPLY=($(compgen -W "$(ls startscripts | xargs) /bin/bash /opt/write_osdeps.bash" -- "$cur"))
return
fi
COMPREPLY=($(compgen -W "base devel release CD storedrelease $(ls startscripts | xargs) /bin/bash write_osdeps" -- "$cur"))
}
complete -F _exec_bash ./exec.bash
complete -F _exec_bash exec.bash
complete -W "base devel release CD storedrelease" ./stop.bash
complete -W "base devel release CD storedrelease" stop.bash
complete -W "base devel release CD storedrelease" ./delete_container.bash
complete -W "base devel release CD storedrelease" delete_container.bash