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 # After installing new aircraft you have to rebuild the aircraft list
14 # by typing $ fgfs --aircraft=?<TAB>
16 __fgfs_root=${FG_ROOT:-/usr/local/share/FlightGear}
17 __fgfs_home=${FG_HOME:-$HOME/.fgfs}
18 [ -d "$__fgfs_home" ] || mkdir -p "$__fgfs_home"
21 __fgfs_ac_list="$__fgfs_home/aircraft.list"
22 __fgfs_apt_list="$__fgfs_home/airport.list"
37 --disable-anti-alias-hud
38 --enable-anti-alias-hud
43 --disable-random-objects
44 --enable-random-objects
51 --disable-clock-freeze
53 --disable-splash-screen
54 --enable-splash-screen
55 --disable-mouse-pointer
56 --enable-mouse-pointer
60 --disable-enhanced-lighting
61 --enable-enhanced-lighting
62 --disable-distance-attenuation
63 --enable-distance-attenuation
64 --disable-specular-highlight
65 --enable-specular-highlight
81 --enable-auto-coordination
82 --disable-auto-coordination
86 --disable-real-weather-fetch
87 --enable-real-weather-fetch
88 --disable-horizon-effect
89 --enable-horizon-effect
96 --disable-save-on-exit
108 --aspect-ratio-multiplier=
183 if [ ${BASH_VERSINFO[0]} -eq 2 ] && [[ ${BASH_VERSINFO[1]} = "05b" ]] \
184 || [ ${BASH_VERSINFO[0]} -gt 2 ]; then
185 __fgfs_nospace="-o nospace"
191 __fgfs_write_ac_list() {
192 rm -f $__fgfs_ac_list
193 for i in $__fgfs_root/Aircraft/*/*-set.xml; do
195 echo ${i##*/} >>$__fgfs_ac_list
200 [ -e $__fgfs_ac_list ] || __fgfs_write_ac_list
203 __fgfs_ai_scenario() {
205 for i in $__fgfs_root/AI/*.xml; do
215 done <$__fgfs_ac_list
222 [ "$i" == "${i%=}" ] && i="$i "
228 __fgfs_options=$(__fgfs_offer $__fgfs_options)
233 local IFS=$'\n'$'\t' cur=${COMP_WORDS[COMP_CWORD]} alt
237 alt=$(__fgfs_offer $(__fgfs_ai_scenario))
242 --aircraft=*|--vehicle=*)
243 alt=$(__fgfs_offer $(__fgfs_aircraft))
246 if [ -e "$__fgfs_apt_list" ]; then
247 alt=$(cat "$__fgfs_apt_list")
249 alt=$(__fgfs_offer khaf kpao koak kmry knuq ksjc kccr ksns krhv klvk o62 lpma)
253 alt=$(__fgfs_offer Nimitz Eisenhower Foch)
256 alt=$(__fgfs_offer joystick keyboard mouse)
259 alt=$(__fgfs_offer pitot static vacuum electrical)
262 alt=$(__fgfs_offer jsbsim yasim uiuc larcsim ufo magic)
265 alt=$(__fgfs_offer 640x480 800x600 1024x768 1152x864 1600x1200)
268 alt=$(__fgfs_offer bulk debug info warn alert)
271 alt=$(__fgfs_offer alpha beta early-production production)
274 alt=$(__fgfs_offer cat-1 cat-2 cat-3 cat-4 park-1)
277 alt=$(__fgfs_offer summer winter)
280 alt=$(__fgfs_offer real dawn morning noon afternoon dusk evening midnight)
286 alt="$__fgfs_options"
290 COMPREPLY=($(compgen -W "$alt" -- ${cur#*=}))
294 complete -o default $__fgfs_nospace -F __fgfs fgfs signs fgfsterra