2 # Tab completion for FlightGear command line options. To use it put
3 # this in your ~/.bashrc file:
5 # export FG_HOME=$HOME/.fgfs/
6 # [ -e $FG_HOME/fg-completion.bash ] && source $FG_HOME/fg-completion.bash
8 # Defining FG_HOME is only required if you don't like the default
9 # "$HOME/.fgfs/". The script doesn't offer all available airports
10 # for the --airport option, but only those listed in a file
11 # $FG_HOME/airport.list if available, or a short default list otherwise.
13 __fgfs_root=${FG_ROOT:-/usr/local/share/FlightGear}
14 __fgfs_home=${FG_HOME:-$HOME/.fgfs}
15 [ -d "$__fgfs_home" ] || mkdir -p "$__fgfs_home"
18 __fgfs_apt_list="$__fgfs_home/airport.list"
33 --disable-anti-alias-hud
34 --enable-anti-alias-hud
39 --disable-random-objects
40 --enable-random-objects
47 --disable-clock-freeze
49 --disable-splash-screen
50 --enable-splash-screen
51 --disable-mouse-pointer
52 --enable-mouse-pointer
56 --disable-enhanced-lighting
57 --enable-enhanced-lighting
58 --disable-distance-attenuation
59 --enable-distance-attenuation
60 --disable-specular-highlight
61 --enable-specular-highlight
77 --enable-auto-coordination
78 --disable-auto-coordination
82 --disable-real-weather-fetch
83 --enable-real-weather-fetch
84 --disable-horizon-effect
85 --enable-horizon-effect
92 --disable-save-on-exit
104 --aspect-ratio-multiplier=
179 if [ ${BASH_VERSINFO[0]} -eq 2 ] && [[ ${BASH_VERSINFO[1]} = "05b" ]] \
180 || [ ${BASH_VERSINFO[0]} -gt 2 ]; then
181 __fgfs_nospace="-o nospace"
187 __fgfs_ai_scenario() {
189 for i in $__fgfs_root/AI/*.xml; do
198 for i in $__fgfs_root/Aircraft/*/*-set.xml; do
208 [ "$i" == "${i%=}" ] && i="$i "
214 __fgfs_options=$(__fgfs_offer $__fgfs_options)
219 local IFS=$'\n'$'\t' cur=${COMP_WORDS[COMP_CWORD]} alt
223 alt=$(__fgfs_offer $(__fgfs_ai_scenario))
225 --aircraft=*|--vehicle=*)
226 alt=$(__fgfs_offer $(__fgfs_aircraft))
229 if [ -e "$__fgfs_apt_list" ]; then
230 alt=$(cat "$__fgfs_apt_list")
232 alt=$(__fgfs_offer khaf kpao koak kmry knuq ksjc kccr ksns krhv klvk o62 lpma)
236 alt=$(__fgfs_offer Nimitz Eisenhower Foch)
239 alt=$(__fgfs_offer joystick keyboard mouse)
242 alt=$(__fgfs_offer pitot static vacuum electrical)
245 alt=$(__fgfs_offer jsbsim yasim uiuc larcsim ufo magic)
248 alt=$(__fgfs_offer 640x480 800x600 1024x768 1152x864 1600x1200)
251 alt=$(__fgfs_offer bulk debug info warn alert)
254 alt=$(__fgfs_offer alpha beta early-production production)
257 alt=$(__fgfs_offer cat-1 cat-2 cat-3 cat-4 park-1)
260 alt=$(__fgfs_offer summer winter)
263 alt=$(__fgfs_offer real dawn morning noon afternoon dusk evening midnight)
269 alt="$__fgfs_options"
273 COMPREPLY=($(compgen -W "$alt" -- ${cur#*=}))
277 complete -o default $__fgfs_nospace -F __fgfs fgfs signs fgfsterra