live-compile aircraft list, instead of requiring to build it
regularly. That's fast enough.
This commit is contained in:
parent
c14730b697
commit
f382f053ff
1 changed files with 11 additions and 31 deletions
|
@ -3,13 +3,7 @@
|
||||||
#
|
#
|
||||||
# 1. define $FG_HOME (or accept the default "$HOME/.fgfs/")
|
# 1. define $FG_HOME (or accept the default "$HOME/.fgfs/")
|
||||||
#
|
#
|
||||||
# 2. run this script to build the $FG_HOME/aircraft.list file and repeat this
|
# 2. source this file from your ~/.bashrc:
|
||||||
# step whenever you added an aircraft (or maintain the aircraft list manually):
|
|
||||||
#
|
|
||||||
# $ $FG_HOME/fg-completion.bash
|
|
||||||
#
|
|
||||||
#
|
|
||||||
# 3. source this file from your ~/.bashrc:
|
|
||||||
#
|
#
|
||||||
# [ -e $FG_HOME/fg-completion.bash ] && source $FG_HOME/fg-completion.bash
|
# [ -e $FG_HOME/fg-completion.bash ] && source $FG_HOME/fg-completion.bash
|
||||||
#
|
#
|
||||||
|
@ -19,7 +13,6 @@ __fgfs_root=${FG_ROOT:-/usr/local/share/FlightGear}
|
||||||
__fgfs_home=${FG_HOME:-$HOME/.fgfs}
|
__fgfs_home=${FG_HOME:-$HOME/.fgfs}
|
||||||
[ -d "$__fgfs_home" ] || mkdir -p "$__fgfs_home"
|
[ -d "$__fgfs_home" ] || mkdir -p "$__fgfs_home"
|
||||||
|
|
||||||
__fgfs_ac_list="$__fgfs_home/aircraft.list"
|
|
||||||
__fgfs_apt_list="$__fgfs_home/airport.list"
|
__fgfs_apt_list="$__fgfs_home/airport.list"
|
||||||
|
|
||||||
__fgfs_options="
|
__fgfs_options="
|
||||||
|
@ -189,28 +182,6 @@ fi
|
||||||
shopt -s progcomp
|
shopt -s progcomp
|
||||||
|
|
||||||
|
|
||||||
__fgfs_make_ac_list() {
|
|
||||||
ls $__fgfs_root/Aircraft/*/*-set.xml|
|
|
||||||
while read i; do
|
|
||||||
i=${i##*/}
|
|
||||||
echo "${i%-set.xml} "
|
|
||||||
done >"$__fgfs_ac_list"
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
if [ "${0##*/}" == "$__fgfs_scriptname" ]; then # run explicitly -- not sourced
|
|
||||||
echo "creating list of available aircraft: $__fgfs_ac_list"
|
|
||||||
__fgfs_make_ac_list
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
|
|
||||||
if [ ! -e "$__fgfs_ac_list" ]; then
|
|
||||||
echo "$0: creating list of available aircraft: $__fgfs_ac_list"
|
|
||||||
__fgfs_make_ac_list
|
|
||||||
fi
|
|
||||||
|
|
||||||
|
|
||||||
__fgfs_ai_scenario() {
|
__fgfs_ai_scenario() {
|
||||||
local i
|
local i
|
||||||
for i in $__fgfs_root/AI/*.xml; do
|
for i in $__fgfs_root/AI/*.xml; do
|
||||||
|
@ -220,6 +191,15 @@ __fgfs_ai_scenario() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
__fgfs_aircraft() {
|
||||||
|
local i
|
||||||
|
for i in $__fgfs_root/Aircraft/*/*-set.xml; do
|
||||||
|
i=${i%-set.xml}
|
||||||
|
echo ${i##*/}
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
__fgfs_offer() {
|
__fgfs_offer() {
|
||||||
local i
|
local i
|
||||||
for i in "$@"; do
|
for i in "$@"; do
|
||||||
|
@ -241,7 +221,7 @@ __fgfs() {
|
||||||
alt=$(__fgfs_offer $(__fgfs_ai_scenario))
|
alt=$(__fgfs_offer $(__fgfs_ai_scenario))
|
||||||
;;
|
;;
|
||||||
--aircraft=*|--vehicle=*)
|
--aircraft=*|--vehicle=*)
|
||||||
alt=$(cat "$__fgfs_ac_list")
|
alt=$(__fgfs_offer $(__fgfs_aircraft))
|
||||||
;;
|
;;
|
||||||
--airport=*)
|
--airport=*)
|
||||||
if [ -e "$__fgfs_apt_list" ]; then
|
if [ -e "$__fgfs_apt_list" ]; then
|
||||||
|
|
Loading…
Add table
Reference in a new issue