first commit
This commit is contained in:
397
scripts/completion/fg-completion.bash
Executable file
397
scripts/completion/fg-completion.bash
Executable file
@@ -0,0 +1,397 @@
|
||||
# © 2014 Raphael Dümig ( duemig at in dot tum dot de ) forum handle: "hamster"
|
||||
# distributed under the terms of the GPLv3
|
||||
|
||||
local_config_file="$HOME/.fgfsrc"
|
||||
|
||||
_get_opt()
|
||||
{
|
||||
local opt len
|
||||
opt=$1
|
||||
len=`expr ${#opt} + 3`
|
||||
|
||||
if [ -e "$local_config_file" ]
|
||||
then
|
||||
stored_opts="$(cat "$local_config_file")"
|
||||
fi
|
||||
|
||||
for word in $stored_opts "${words[@]}"
|
||||
do
|
||||
if [ "${word:0:$len}" == "--$opt=" ]
|
||||
then
|
||||
# TODO: we have to get rid of at least the most important escape sequences!!!
|
||||
value="$(echo "${word:$len}" | sed 's/\\ / /g')"
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
_get_opts()
|
||||
{
|
||||
local opt len
|
||||
opt=$1
|
||||
len=`expr ${#opt} + 3`
|
||||
value=""
|
||||
|
||||
if [ -e "$local_config_file" ]
|
||||
then
|
||||
stored_opts="$(cat "$local_config_file")"
|
||||
fi
|
||||
|
||||
for word in "$stored_opts ${words[@]}"
|
||||
do
|
||||
if [ "${word:0:$len}" == "--$opt=" ]
|
||||
then
|
||||
value+="$(echo "${word:$len}" | sed 's/\\ / /g') "
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
_get_fg_root()
|
||||
{
|
||||
local value
|
||||
_get_opt "fg-root"
|
||||
|
||||
# value on the command line?
|
||||
if [ -n "$value" ]
|
||||
then
|
||||
root="$value"
|
||||
return 0
|
||||
# value stored in environment variable $FG_ROOT?
|
||||
else if [ -n "$FG_ROOT" ]
|
||||
then
|
||||
root="$FG_ROOT"
|
||||
return 0
|
||||
# no clue! search at the most common places
|
||||
else
|
||||
for path in /usr{/local,}/share{/games,}/{F,f}light{G,g}ear{/data,} {~,}/Applications/FlightGear.app/Contents/Resources/data
|
||||
do
|
||||
if [ -e "$path" ]
|
||||
then
|
||||
root="$path"
|
||||
break
|
||||
fi
|
||||
done
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
_get_fg_scenery()
|
||||
{
|
||||
local value
|
||||
_get_opt "fg-scenery"
|
||||
|
||||
# value on command line?
|
||||
if [ -n "$value" ]
|
||||
then
|
||||
scenery="$value"
|
||||
# value stored in environment variable $FG_SCENERY?
|
||||
else if [ -n "$FG_SCENERY" ]
|
||||
then
|
||||
scenery="$FG_SCENERY"
|
||||
# no clue! try default:
|
||||
else
|
||||
local root
|
||||
_get_fg_root
|
||||
scenery="$root/Scenery"
|
||||
fi
|
||||
fi
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
_get_fg_aircraft()
|
||||
{
|
||||
local value
|
||||
_get_opt "fg-aircraft"
|
||||
|
||||
# value on command line?
|
||||
if [ -n "$value" ]
|
||||
then
|
||||
aircraft_dir="$value"
|
||||
# value stored in environment variable $FG_AIRCRAFT?
|
||||
else if [ -n "$FG_AIRCRAFT" ]
|
||||
then
|
||||
aircraft_dir="$FG_AIRCRAFT"
|
||||
# no clue! try default:
|
||||
else
|
||||
local root
|
||||
_get_fg_root
|
||||
aircraft_dir="$root/Aircraft"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
_get_airport()
|
||||
{
|
||||
local value
|
||||
_get_opt "airport"
|
||||
|
||||
if [ -z "$value" ]
|
||||
then
|
||||
airport="KSFO"
|
||||
else
|
||||
airport=$value
|
||||
fi
|
||||
}
|
||||
|
||||
_get_carrier()
|
||||
{
|
||||
local value
|
||||
_get_opt "carrier"
|
||||
|
||||
carrier=$value
|
||||
}
|
||||
|
||||
_get_scenarios()
|
||||
{
|
||||
local value
|
||||
_get_opts "ai-scenario"
|
||||
|
||||
scenarios="$value nimitz_demo"
|
||||
}
|
||||
|
||||
|
||||
_fgfs()
|
||||
{
|
||||
local cur prev words cword split
|
||||
_init_completion -s || return
|
||||
|
||||
local root airport aircraft_dir carrier scenarios scenery value
|
||||
|
||||
# auto-completion for values of keys ( --key=value )
|
||||
case "$prev" in
|
||||
--fg-aircraft|--fg-root|--fg-scenery|--flight-plan|--terrasync-dir|--materials-file|--config|--browser-app)
|
||||
# completion of filesystem path
|
||||
_filedir
|
||||
return 0 ;;
|
||||
--ai-scenario)
|
||||
# list of scenarios in $FG_ROOT/AI
|
||||
_get_fg_root
|
||||
scenarios="$(find "$root/AI" -maxdepth 1 -iname *.xml -printf '%f\n' | sed -e 's/.xml$//')"
|
||||
|
||||
COMPREPLY=( $(compgen -W "${scenarios}" -- ${cur}) )
|
||||
return 0 ;;
|
||||
--aircraft|--vehicle)
|
||||
# list of aircrafts in $FG_AIRCRAFT
|
||||
_get_fg_aircraft
|
||||
aircrafts="$(find "$aircraft_dir" -maxdepth 2 -mindepth 2 -iname *-set.xml -printf '%f\n' | sed -e 's/-set.xml$//')"
|
||||
|
||||
COMPREPLY=( $(compgen -W "${aircrafts}" -- ${cur}) )
|
||||
return 0 ;;
|
||||
--airport)
|
||||
_get_fg_root
|
||||
_get_fg_scenery
|
||||
# is an index file present in the scenery?
|
||||
if [ -e "$scenery/Airports/index.txt" ]
|
||||
then
|
||||
COMPREPLY=( $(compgen -W "$(awk 'BEGIN { FS="|"; } { print $1 }' "$scenery/Airports/index.txt")" -- ${cur}) )
|
||||
return 0
|
||||
# or at least the apt.dat file?
|
||||
else if [ -e "$root/Airports/apt.dat.gz" ]
|
||||
then
|
||||
COMPREPLY=( $(compgen -W "$(zcat "$root/Airports/apt.dat.gz" | awk '/^1 / { print $5 }')" -- ${cur}) )
|
||||
return 0
|
||||
fi
|
||||
fi
|
||||
|
||||
return 0 ;;
|
||||
--carrier)
|
||||
_get_fg_root
|
||||
_get_scenarios
|
||||
|
||||
carriers=""
|
||||
|
||||
for scenario in $scenarios
|
||||
do
|
||||
carriers+="$(awk -- '
|
||||
BEGIN { carrier=0; name=""; }
|
||||
/<type>/ {
|
||||
a=index($0,"<type>")+6; s=index(substr($0,a),"</type>")-1;
|
||||
if(substr($0,a,s) == "carrier") carrier=1;
|
||||
}
|
||||
/<name>/ {
|
||||
if(carrier) {
|
||||
a=index($0,"<name>")+6; s=index(substr($0,a),"</name>")-1;
|
||||
print substr($0,a,s);
|
||||
carrier=0;
|
||||
}
|
||||
}
|
||||
/<\/entry>/ {
|
||||
carrier=0;
|
||||
name="";
|
||||
}' "$root/AI/$scenario.xml") "
|
||||
done
|
||||
|
||||
COMPREPLY=( $(compgen -W "${carriers}" ${cur}) )
|
||||
return 0 ;;
|
||||
--runway)
|
||||
_get_fg_scenery
|
||||
_get_airport
|
||||
|
||||
# try to find a thresholds file
|
||||
path="$scenery/Airports/${airport:0:1}/${airport:1:1}/${airport:2:1}"
|
||||
|
||||
if [ -e "$path/$airport.threshold.xml" ]
|
||||
then
|
||||
runways="$(awk -- '
|
||||
/<rwy>/ {
|
||||
a=index($0,"<rwy>")+5;
|
||||
s=index(substr($0,a),"</rwy>")-1;
|
||||
print substr($0,a,s)
|
||||
}' "$path/$airport.threshold.xml")"
|
||||
fi
|
||||
|
||||
COMPREPLY=( $(compgen -W "${runways}" -- ${cur}) )
|
||||
return 0 ;;
|
||||
--parkpos)
|
||||
# try to find out the name of the carrier or the ID of the airport
|
||||
_get_carrier
|
||||
|
||||
if [ -n "$carrier" ]
|
||||
then
|
||||
_get_fg_root
|
||||
_get_scenarios
|
||||
|
||||
for scenario in $scenarios
|
||||
do
|
||||
positions="$(awk -v carrier_name="$carrier" '
|
||||
BEGIN { carrier=0; name=0; parkpos=0; }
|
||||
/<type>/ {
|
||||
a=index($0,"<type>")+6; s=index(substr($0,a),"</type>")-1;
|
||||
if(substr($0,a,s) == "carrier") carrier=1;
|
||||
}
|
||||
/<parking-pos>/ {
|
||||
parkpos=(carrier && name);
|
||||
}
|
||||
/<name>/ {
|
||||
a=index($0,"<name>")+6; s=index(substr($0,a),"</name>")-1;
|
||||
if(parkpos) print substr($0,a,s);
|
||||
else if(carrier) name=(substr($0,a,s) == carrier_name);
|
||||
}
|
||||
/<\/parking-pos>/ {
|
||||
parkpos=0;
|
||||
}
|
||||
/<\/entry>/ {
|
||||
carrier=name=parkpos=0;
|
||||
}' "$root/AI/$scenario.xml")"
|
||||
|
||||
if [ -n "$positions" ]
|
||||
then
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
else
|
||||
_get_fg_scenery
|
||||
_get_airport
|
||||
|
||||
# search for the groundnet or parking file
|
||||
path="$scenery/Airports/${airport:0:1}/${airport:1:1}/${airport:2:1}"
|
||||
|
||||
if [ -e "$path/$airport.groundnet.xml" ]
|
||||
then
|
||||
file="$airport.groundnet.xml"
|
||||
else if [ -e "$path/$airport.parking.xml" ]
|
||||
then
|
||||
file="$airport.parking.xml"
|
||||
else
|
||||
# no file found => do not try to analyze it!
|
||||
return 0
|
||||
fi
|
||||
fi
|
||||
|
||||
# build a list of the parking positions at that airport
|
||||
positions="$(awk -- '
|
||||
/<Parking/ {
|
||||
pos_active=1;
|
||||
name=number="";
|
||||
}
|
||||
/name="/ {
|
||||
if(pos_active) {
|
||||
a=index($0,"name=\"")+6;
|
||||
s=index(substr($0,a),"\"")-1;
|
||||
name=substr($0,a,s);
|
||||
}
|
||||
}
|
||||
/number="/ {
|
||||
if(pos_active) {
|
||||
a=index($0,"number=\"")+8;
|
||||
s=index(substr($0,a),"\"")-1;
|
||||
number=substr($0,a,s);
|
||||
}
|
||||
}
|
||||
/\/>/ {
|
||||
if(pos_active == 1 && (name!="" || number!="")) print name number;
|
||||
pos_active=0;
|
||||
name=number="";
|
||||
}' "$path/$file")"
|
||||
fi
|
||||
|
||||
COMPREPLY=( $(compgen -W "${positions}" -- ${cur}) )
|
||||
return 0 ;;
|
||||
--control)
|
||||
COMPREPLY=( $(compgen -W "joystick keyboard mouse" -- ${cur}) )
|
||||
return 0 ;;
|
||||
--failure)
|
||||
COMPREPLY=( $(compgen -W "pitot static vacuum electrical" -- ${cur}) )
|
||||
return 0 ;;
|
||||
--fix)
|
||||
_get_fg_root
|
||||
COMPREPLY=( $(compgen -W "$(zcat "$root/Navaids/fix.dat.gz" | awk '{ print substr($3,0,5) }')" -- ${cur}) )
|
||||
return 0 ;;
|
||||
--fdm)
|
||||
COMPREPLY=( $(compgen -W "jsb larcsim yasim magic balloon ada external null" -- ${cur}) )
|
||||
return 0 ;;
|
||||
--min-status)
|
||||
COMPREPLY=( $(compgen -W "alpha beta early-production production" -- ${cur}) )
|
||||
return 0 ;;
|
||||
--log-class)
|
||||
COMPREPLY=( $(compgen -W "ai environment flight general io network sound terrain" -- ${cur}) )
|
||||
return 0 ;;
|
||||
--log-level)
|
||||
COMPREPLY=( $(compgen -W "bulk debug info warn alert" -- ${cur}) )
|
||||
return 0 ;;
|
||||
--ndb)
|
||||
_get_fg_root
|
||||
COMPREPLY=( $(compgen -W "$(zcat "$root/Navaids/nav.dat.gz" | awk '/^2 / { print $8 }')" -- ${cur}) )
|
||||
return 0 ;;
|
||||
--ndb-frequency)
|
||||
_get_fg_root
|
||||
_get_opt "ndb"
|
||||
COMPREPLY=( $(compgen -W "$(zcat "$root/Navaids/nav.dat.gz" | awk -v nav=$value '/^2 / { if($8 == nav) print $5 }')" -- ${cur}) )
|
||||
return 0 ;;
|
||||
--season)
|
||||
COMPREPLY=( $(compgen -W "summer winter" -- ${cur}) )
|
||||
return 0 ;;
|
||||
--texture-filtering)
|
||||
COMPREPLY=( $(compgen -W "1 2 4 8 16" -- ${cur}) )
|
||||
return 0 ;;
|
||||
--timeofday)
|
||||
COMPREPLY=( $(compgen -W "real dawn morning noon afternoon dusk evening midnight" -- ${cur}) )
|
||||
return 0 ;;
|
||||
--view-offset)
|
||||
COMPREPLY=( $(compgen -W "LEFT RIGHT CENTER" -- ${cur}) )
|
||||
return 0 ;;
|
||||
--vor)
|
||||
_get_fg_root
|
||||
COMPREPLY=( $(compgen -W "$(zcat "$root/Navaids/nav.dat.gz" | awk '/^3 / { print $8 }')" -- ${cur}) )
|
||||
return 0 ;;
|
||||
--vor-frequency)
|
||||
_get_fg_root
|
||||
_get_opt "vor"
|
||||
COMPREPLY=( $(compgen -W "$(zcat "$root/Navaids/nav.dat.gz" | awk -v nav=$value '/^3 / { if($8 == nav) print substr($5,0,3) "." substr($5,4) }')" -- ${cur}) )
|
||||
return 0 ;;
|
||||
esac
|
||||
|
||||
case "${cur}" in
|
||||
-*)
|
||||
# auto completion for options
|
||||
COMPREPLY=( $(compgen -W "$(_parse_help fgfs "--help --verbose")" -- ${cur}) )
|
||||
# no whitespace after keys
|
||||
[[ $COMPREPLY == *= ]] && compopt -o nospace ;;
|
||||
*)
|
||||
_filedir
|
||||
esac
|
||||
|
||||
return 0
|
||||
}
|
||||
complete -F _fgfs fgfs
|
||||
303
scripts/completion/fg-completion.zsh
Executable file
303
scripts/completion/fg-completion.zsh
Executable file
@@ -0,0 +1,303 @@
|
||||
#compdef fgfs
|
||||
|
||||
local _fgfs_root
|
||||
local _fgfs_options
|
||||
|
||||
local state
|
||||
|
||||
|
||||
_fgfs_root=${FG_ROOT:-/usr/local/share/FlightGear}
|
||||
|
||||
|
||||
_fgfs_options=(
|
||||
'(-h --help)'{-h,--help}'[Show the most relevant command line options]' \
|
||||
'--version[FlightGear version]' \
|
||||
'--verbose[Show all command line options when combined --help or -h]' \
|
||||
'--disable-intro-music[Disable introduction music]' \
|
||||
'--enable-intro-music[Enable introduction music]' \
|
||||
'--units-feet[Use feet for distances]' \
|
||||
'--units-meters[Use meters for distances]' \
|
||||
'--disable-sound[Disable sound effects]' \
|
||||
'--enable-sound[Enable sound effects]' \
|
||||
'--disable-panel[Disable instrument panel]' \
|
||||
'--enable-panel[Enable instrument panel]' \
|
||||
'--disable-hud[Disable Heads Up Display (HUD)]' \
|
||||
'--enable-hud[Enable Heads Up Display (HUD)]' \
|
||||
'--disable-anti-alias-hud[Disable anti-aliased HUD]' \
|
||||
'--enable-anti-alias-hud[Enable anti-aliased HUD]' \
|
||||
'--disable-hud-3d[Disable 3D HUD]' \
|
||||
'--enable-hud-3d[Enable 3D HUD]' \
|
||||
'--hud-tris[Hud displays number of triangles rendered]' \
|
||||
'--hud-culled[Hud displays percentage of triangles culled]' \
|
||||
'--disable-random-objects[Exclude random scenery objects (buildings, etc.)]' \
|
||||
'--enable-random-objects[Include random scenery objects (buildings, etc.)]' \
|
||||
'--disable-ai-models[Disable the artifical traffic subsystem]' \
|
||||
'--enable-ai-models[Enable the artifical traffic]' \
|
||||
'--disable-freeze[Start in a running state]' \
|
||||
'--enable-freeze[Start in a frozen state]' \
|
||||
'--disable-fuel-freeze[Fuel is consumed normally]' \
|
||||
'--enable-fuel-freeze[Fuel tank quantity forced to remain constant]' \
|
||||
'--disable-clock-freeze[Clock advances normally]' \
|
||||
'--enable-clock-freeze[Do not advance clock]' \
|
||||
'--disable-splash-screen[Disable splash screen]' \
|
||||
'--enable-splash-screen[Enable splash screen]' \
|
||||
'--disable-mouse-pointer[Disable extra mouse pointer]' \
|
||||
'--enable-mouse-pointer[Enable extra mouse pointer]' \
|
||||
'--fog-disable[Disable fog/haze]' \
|
||||
'--fog-fastest[Enable fastest fog/haze]' \
|
||||
'--fog-nicest[Enable nicest fog/haze]' \
|
||||
'--disable-distance-attenuation[Disable runway light distance attenuation]' \
|
||||
'--enable-distance-attenuation[Enable runway light distance attenuation]' \
|
||||
'--disable-specular-highlight[Disable specular reflections on textured objects]' \
|
||||
'--enable-specular-highlight[Enable specular reflections on textured objects]' \
|
||||
'--disable-fullscreen[Disable fullscreen mode]' \
|
||||
'--enable-fullscreen[Enable fullscreen mode]' \
|
||||
'--disable-game-mode[Disable full-screen game mode]' \
|
||||
'--enable-game-mode[Enable full-screen game mode]' \
|
||||
'--shading-flat[Enable flat shading]' \
|
||||
'--shading-smooth[Enable smooth shading]' \
|
||||
'--disable-skyblend[Disable sky blending]' \
|
||||
'--enable-skyblend[Enable sky blending]' \
|
||||
'--disable-textures[Disable textures]' \
|
||||
'--enable-textures[Enable textures]' \
|
||||
'--disable-vr[Disable VR]' \
|
||||
'--enable-vr[Enable VR]' \
|
||||
'--disable-wireframe[Disable wireframe drawing mode]' \
|
||||
'--enable-wireframe[Enable wireframe drawing mode]' \
|
||||
'--notrim[Do NOT attempt to trim the model (only with fdm=jsbsim)]' \
|
||||
'--on-ground[Start at ground level (default)]' \
|
||||
'--in-air[Start in air (implied when using --altitude)]' \
|
||||
'--enable-auto-coordination[Enable auto coordination]' \
|
||||
'--disable-auto-coordination[Disable auto coordination]' \
|
||||
'--show-aircraft[Print a list of the currently available aircraft types]' \
|
||||
'--time-match-real[Synchronize time with real-world time]' \
|
||||
'--time-match-local[Synchronize time with local real-world time]' \
|
||||
'--disable-real-weather-fetch[Disbale METAR based real weather fetching]' \
|
||||
'--enable-real-weather-fetch[Enable METAR based real weather fetching]' \
|
||||
'--disable-horizon-effect[Disable celestial body growth illusion near the horizon]' \
|
||||
'--enable-horizon-effect[Enable celestial body growth illusion near the horizon]' \
|
||||
'--enable-clouds[Enable 2D (flat) cloud layers]' \
|
||||
'--disable-clouds[Disable 2D (flat) cloud layers]' \
|
||||
'--enable-clouds3d[Enable 3D (volumetric) cloud layers]' \
|
||||
'--disable-clouds3d[Disable 3D (volumetric) cloud layers]' \
|
||||
'--atc610x[Enable atc610x interface]' \
|
||||
'--enable-save-on-exit[Allow saving preferences at program exit]' \
|
||||
'--disable-save-on-exit[Do not save preferences upon program exit]' \
|
||||
'--ai-scenario=[Add and enable a new scenario]:AI scenario:->ai-scenario' \
|
||||
'--fg-root=[Specify the root data path]:Directories:_directories' \
|
||||
'--fg-scenery=[Specify the base scenery path]:Directories:_directories' \
|
||||
'--language=[Select the language for this session]:Language:->language' \
|
||||
'--browser-app=[Specify path to your web browser]:Directories:_directories' \
|
||||
'--config=[Load additional properties from path]' \
|
||||
'--failure=[Fail the pitot, static, vacuum, or electrical system]:Failure system:(pitot static vaccum electical)'
|
||||
'--bpp=[Specify the bits per pixel]' \
|
||||
'--fov=[Specify field of view angle]' \
|
||||
'--callsign=[Assign a unique name to a player]' \
|
||||
'--aspect-ratio-multiplier=[Specify a multiplier for the aspect ratio]' \
|
||||
'--geometry=[Specify window geometry (640x480, etc)]' \
|
||||
'--view-offset=[Specify the default forward view direction as an offset from straight ahead]' \
|
||||
'--aircraft=[Select an aircraft profile]:Aircraft:->aircraft' \
|
||||
'--min-status=[Allows you to define a minimum status level for all listed aircraft]:Minimum status level:(alpha beta early-production production)' \
|
||||
'--fdm=[Select the core flight dynamics model]:Core flight dynamics model:(jsb larcsim yasim magic balloon ada external)' \
|
||||
'--aero=[Select aircraft aerodynamics model to load]' \
|
||||
'--model-hz=[Run the FDM this rate (iterations per second)]' \
|
||||
'--speed=[Run the FDM n times faster than real time]' \
|
||||
'--aircraft-dir=[Aircraft directory relative to the path of the executable]:Aircraft directory:_directories' \
|
||||
'--timeofday=[Specify a time of day]:Time of day:(real dawn morning noon afternoon dusk evening midnight)' \
|
||||
'--time-offset=[Add this time offset (+/-hh:mm:ss)]' \
|
||||
'--start-date-sys=[Specify a starting date/time with respect to system time (yyyy:mm:dd:hh:mm:ss)]' \
|
||||
'--start-date-gmt=[Specify a starting date/time with respect to Greenwich Mean Time (yyyy:mm:dd:hh:mm:ss)]' \
|
||||
'--start-date-lat=[Specify a starting date/time with respect to Local Aircraft Time (yyyy:mm:dd:hh:mm:ss)]' \
|
||||
'--airport=[Specify starting position relative to an airport]:Airport:->airport' \
|
||||
'--runway=[Specify starting runway (must also specify an airport)]:Runway:->runway' \
|
||||
'--carrier=[Specify starting position on an AI carrier]:AI carrier:(Nimitz Eisenhower Foch)' \
|
||||
'--parkpos=[Specify which starting position on an AI carrier]:Park position:->parkpos' \
|
||||
'--vor=[Specify starting position relative to a VOR]:VOR:->vor' \
|
||||
'--ndb=[Specify starting position relative to an NDB]:NDB:->ndb' \
|
||||
'--fix=[Specify starting position relative to a fix]:FIX:->fix' \
|
||||
'--offset-distance=[Specify distance to reference point (in miles)]' \
|
||||
'--offset-azimuth=[Specify heading to reference point (in degrees)]' \
|
||||
'--lon=[Starting longitude (in degrees)]' \
|
||||
'--lat=[Starting latitude (in degrees)]' \
|
||||
'--altitude=[Starting altitude]' \
|
||||
'--heading=[Specify heading (yaw) angle (Psi)]' \
|
||||
'--roll=[Specify roll angle (Phi)]' \
|
||||
'--pitch=[Specify pitch angle (Theta)]' \
|
||||
'--uBody=[Specify velocity along the body X axis]' \
|
||||
'--vBody=[Specify velocity along the body Y axis]' \
|
||||
'--wBody=[Specify velocity along the body Z axis]' \
|
||||
'--vc=[Specify initial airspeed (in knots)]' \
|
||||
'--mach=[Specify initial mach number]' \
|
||||
'--glideslope=[Specify flight path angle (in degrees)]' \
|
||||
'--roc=[Specify initial climb rate]' \
|
||||
'--wp=[Specify a waypoint for the GC autopilot]' \
|
||||
'--flight-plan=[Read all waypoints from a file]:Waypoints file:_files' \
|
||||
'--nav1=[Set the NAV1 radio frequency, optionally preceded by a radial]' \
|
||||
'--nav2=[Set the NAV2 radio frequency, optionally preceded by a radial]' \
|
||||
'--adf1=[Set the ADF1 radio frequency, optionally preceded by a card rotation]' \
|
||||
'--adf2=[Set the ADF2 radio frequency, optionally preceded by a card rotation]' \
|
||||
'--dme=[Slave the ADF to one of the NAV radios, or set its internal frequency]' \
|
||||
'--visibility=[Specify initial visibility (in meters)]' \
|
||||
'--visibility-miles=[Specify initial visibility (in miles)]' \
|
||||
'--wind=[Specify wind coming from DIR (degrees) - SPEED (knots) - (DIR@SPEED)]' \
|
||||
'--turbulence=[Specify turbulence from 0.0 (calm) to 1.0 (severe)]' \
|
||||
'--ceiling=[Create an overcast ceiling, optionally with a specific thickness]' \
|
||||
'--multiplay=[Specify multipilot communication settings ({in|out},hz,address,port)]' \
|
||||
'--proxy=[Specify which proxy server (and port) to use (user:pwd@host:port)]' \
|
||||
'--httpd=[Enable http server on the specified port]' \
|
||||
'--telnet=[Enable telnet server on the specified port]' \
|
||||
'--jpg-httpd=[Enable screen shot http server on the specified port]' \
|
||||
'--generic=[Open connection using a predefined communication interface]' \
|
||||
'--garmin=[Open connection using the Garmin GPS protocol]' \
|
||||
'--joyclient=[Open connection to an Agwagon joystick]' \
|
||||
'--jsclient=[Open connection to a remote joystick]' \
|
||||
'--native-ctrls=[Open connection using the FG Native Controls protocol]' \
|
||||
'--native-fdm=[Open connection using the FG Native FDM protocol]' \
|
||||
'--native=[Open connection using the FG Native protocol]' \
|
||||
'--nmea=[Open connection using the NMEA protocol]' \
|
||||
'--opengc=[Open connection using the OpenGC protocol]' \
|
||||
'--props=[Open connection using the interactive property manager]' \
|
||||
'--pve=[Open connection using the PVE protocol]' \
|
||||
'--ray=[Open connection using the Ray Woodworth motion chair protocol]' \
|
||||
'--rul=[Open connection using the RUL protocol]' \
|
||||
'--log-level=[Specify which loggin level to use]:Log level:(bulk debug info warn alert)' \
|
||||
'--trace-read=[Trace the reads for a property]' \
|
||||
'--trace-write=[Trace the writes for a property]' \
|
||||
'--season=[Specify the startup season]:Season:(summer winter)' \
|
||||
'--vehicle=[Select a vehicle profile]:Vehicle:->vehicle' \
|
||||
'--prop:[]'
|
||||
)
|
||||
|
||||
|
||||
_fgfs_ai_scenario() {
|
||||
local i
|
||||
local result
|
||||
|
||||
if ! zstyle -a ":completion:${curcontext}:" fgfs ai_scenario; then
|
||||
(( $+_cache_ai_scenario )) ||
|
||||
for i in $_fgfs_root/AI/*.xml; do
|
||||
i=${i%.xml}
|
||||
_cache_ai_scenario+=( ${i##*/} )
|
||||
done
|
||||
result=( "$_cache_ai_scenario[@]" )
|
||||
fi
|
||||
|
||||
compadd -a "$@" - result
|
||||
}
|
||||
|
||||
|
||||
_fgfs_aircraft() {
|
||||
local i
|
||||
local result
|
||||
|
||||
if ! zstyle -a ":completion:${curcontext}:" fgfs aircraft; then
|
||||
(( $+_cache_aircraft )) ||
|
||||
for i in $_fgfs_root/Aircraft/*/*-set.xml; do
|
||||
i=${i%-set.xml}
|
||||
_cache_aircraft+=( ${i##*/} )
|
||||
done
|
||||
|
||||
result=( "$_cache_aircraft[@]" )
|
||||
fi
|
||||
|
||||
compadd -a "$@" - result
|
||||
}
|
||||
|
||||
|
||||
_fgfs_airport() {
|
||||
local line
|
||||
local result
|
||||
|
||||
if ! zstyle -a ":completion:${curcontext}:" fgfs airport; then
|
||||
(( $+_cache_airport )) ||
|
||||
gunzip -c $_fgfs_root/Airports/apt.dat.gz |
|
||||
while read line; do
|
||||
if [[ $line = "" ]]; then
|
||||
read line
|
||||
_cache_airport+=( $line[(w)5] )
|
||||
fi
|
||||
done
|
||||
|
||||
result=( "$_cache_airport[@]" )
|
||||
fi
|
||||
|
||||
compadd -a "$@" - result
|
||||
}
|
||||
|
||||
|
||||
_fgfs_runway() {
|
||||
local airport
|
||||
local line
|
||||
local result
|
||||
|
||||
[[ $words == *--airport=(#b)([a-zA-Z]#)* ]] && airport=$match[1]
|
||||
|
||||
if [[ $airport = "" ]]; then
|
||||
_message "Please choose airport !"
|
||||
|
||||
return
|
||||
fi
|
||||
|
||||
if ! zstyle -a ":completion:${curcontext}:" fgfs runway_$airport; then
|
||||
(( $+_cache_runway )) ||
|
||||
gunzip -c $_fgfs_root/Airports/apt.dat.gz |
|
||||
while read line; do
|
||||
if [[ $line = "" ]]; then
|
||||
read line
|
||||
name=( $line[(w)5] )
|
||||
if [[ $name = $airport ]]; then
|
||||
while read line; do
|
||||
_cache_runway+=( $line[(w)4] )
|
||||
break
|
||||
done
|
||||
break
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
||||
_cache_airport_name=$airport
|
||||
|
||||
result=( "$_cache_runway[@]" );
|
||||
fi
|
||||
|
||||
compadd -a "$@" - result
|
||||
}
|
||||
|
||||
|
||||
_arguments -C -s "$_fgfs_options[@]" && return 0
|
||||
|
||||
|
||||
case $state in
|
||||
ai-scenario)
|
||||
_fgfs_ai_scenario && return 0
|
||||
;;
|
||||
|
||||
language)
|
||||
;;
|
||||
|
||||
aircraft|vehicle)
|
||||
_fgfs_aircraft && return 0
|
||||
;;
|
||||
|
||||
airport)
|
||||
_fgfs_airport && return 0
|
||||
;;
|
||||
|
||||
runway)
|
||||
_fgfs_runway && return 0
|
||||
;;
|
||||
|
||||
parkpos)
|
||||
;;
|
||||
|
||||
vor)
|
||||
;;
|
||||
|
||||
ndb)
|
||||
;;
|
||||
|
||||
fix)
|
||||
;;
|
||||
esac
|
||||
|
||||
|
||||
Reference in New Issue
Block a user