]> git.mxchange.org Git - flightgear.git/blob - scripts/completion/fg-completion.zsh
Launcher shows polygon/polyline data
[flightgear.git] / scripts / completion / fg-completion.zsh
1 #compdef fgfs
2
3 local _fgfs_root
4 local _fgfs_options
5
6 local state
7
8
9 _fgfs_root=${FG_ROOT:-/usr/local/share/FlightGear}
10
11
12 _fgfs_options=(
13         '(-h --help)'{-h,--help}'[Show the most relevant command line options]' \
14         '--version[FlightGear version]' \
15         '--verbose[Show all command line options when combined --help or -h]' \
16         '--disable-intro-music[Disable introduction music]' \
17         '--enable-intro-music[Enable introduction music]' \
18         '--units-feet[Use feet for distances]' \
19         '--units-meters[Use meters for distances]' \
20         '--disable-sound[Disable sound effects]' \
21         '--enable-sound[Enable sound effects]' \
22         '--disable-panel[Disable instrument panel]' \
23         '--enable-panel[Enable instrument panel]' \
24         '--disable-hud[Disable Heads Up Display (HUD)]' \
25         '--enable-hud[Enable Heads Up Display (HUD)]' \
26         '--disable-anti-alias-hud[Disable anti-aliased HUD]' \
27         '--enable-anti-alias-hud[Enable anti-aliased HUD]' \
28         '--disable-hud-3d[Disable 3D HUD]' \
29         '--enable-hud-3d[Enable 3D HUD]' \
30         '--hud-tris[Hud displays number of triangles rendered]' \
31         '--hud-culled[Hud displays percentage of triangles culled]' \
32         '--disable-random-objects[Exclude random scenery objects (buildings, etc.)]' \
33         '--enable-random-objects[Include random scenery objects (buildings, etc.)]' \
34         '--disable-ai-models[Disable the artifical traffic subsystem]' \
35         '--enable-ai-models[Enable the artifical traffic]' \
36         '--disable-freeze[Start in a running state]' \
37         '--enable-freeze[Start in a frozen state]' \
38         '--disable-fuel-freeze[Fuel is consumed normally]' \
39         '--enable-fuel-freeze[Fuel tank quantity forced to remain constant]' \
40         '--disable-clock-freeze[Clock advances normally]' \
41         '--enable-clock-freeze[Do not advance clock]' \
42         '--disable-splash-screen[Disable splash screen]' \
43         '--enable-splash-screen[Enable splash screen]' \
44         '--disable-mouse-pointer[Disable extra mouse pointer]' \
45         '--enable-mouse-pointer[Enable extra mouse pointer]' \
46         '--fog-disable[Disable fog/haze]' \
47         '--fog-fastest[Enable fastest fog/haze]' \
48         '--fog-nicest[Enable nicest fog/haze]' \
49         '--disable-enhanced-lighting[Disable enhanced runway lighting]' \
50         '--enable-enhanced-lighting[Enable enhanced runway lighting]' \
51         '--disable-distance-attenuation[Disable runway light distance attenuation]' \
52         '--enable-distance-attenuation[Enable runway light distance attenuation]' \
53         '--disable-specular-highlight[Disable specular reflections on textured objects]' \
54         '--enable-specular-highlight[Enable specular reflections on textured objects]' \
55         '--disable-fullscreen[Disable fullscreen mode]' \
56         '--enable-fullscreen[Enable fullscreen mode]' \
57         '--disable-game-mode[Disable full-screen game mode]' \
58         '--enable-game-mode[Enable full-screen game mode]' \
59         '--shading-flat[Enable flat shading]' \
60         '--shading-smooth[Enable smooth shading]' \
61         '--disable-skyblend[Disable sky blending]' \
62         '--enable-skyblend[Enable sky blending]' \
63         '--disable-textures[Disable textures]' \
64         '--enable-textures[Enable textures]' \
65         '--disable-wireframe[Disable wireframe drawing mode]' \
66         '--enable-wireframe[Enable wireframe drawing mode]' \
67         '--notrim[Do NOT attempt to trim the model (only with fdm=jsbsim)]' \
68         '--on-ground[Start at ground level (default)]' \
69         '--in-air[Start in air (implied when using --altitude)]' \
70         '--enable-auto-coordination[Enable auto coordination]' \
71         '--disable-auto-coordination[Disable auto coordination]' \
72         '--show-aircraft[Print a list of the currently available aircraft types]' \
73         '--time-match-real[Synchronize time with real-world time]' \
74         '--time-match-local[Synchronize time with local real-world time]' \
75         '--disable-real-weather-fetch[Disbale METAR based real weather fetching]' \
76         '--enable-real-weather-fetch[Enable METAR based real weather fetching]' \
77         '--disable-horizon-effect[Disable celestial body growth illusion near the horizon]' \
78         '--enable-horizon-effect[Enable celestial body growth illusion near the horizon]' \
79         '--enable-clouds[Enable 2D (flat) cloud layers]' \
80         '--disable-clouds[Disable 2D (flat) cloud layers]' \
81         '--enable-clouds3d[Enable 3D (volumetric) cloud layers]' \
82         '--disable-clouds3d[Disable 3D (volumetric) cloud layers]' \
83         '--atc610x[Enable atc610x interface]' \
84         '--enable-save-on-exit[Allow saving preferences at program exit]' \
85         '--disable-save-on-exit[Do not save preferences upon program exit]' \
86         '--ai-scenario=[Add and enable a new scenario]:AI scenario:->ai-scenario' \
87         '--fg-root=[Specify the root data path]:Directories:_directories' \
88         '--fg-scenery=[Specify the base scenery path]:Directories:_directories' \
89         '--language=[Select the language for this session]:Language:->language' \
90         '--browser-app=[Specify path to your web browser]:Directories:_directories' \
91         '--config=[Load additional properties from path]' \
92         '--failure=[Fail the pitot, static, vacuum, or electrical system]:Failure system:(pitot static vaccum electical)'
93         '--bpp=[Specify the bits per pixel]' \
94         '--fov=[Specify field of view angle]' \
95         '--callsign=[Assign a unique name to a player]' \
96         '--aspect-ratio-multiplier=[Specify a multiplier for the aspect ratio]' \
97         '--geometry=[Specify window geometry (640x480, etc)]' \
98         '--view-offset=[Specify the default forward view direction as an offset from straight ahead]' \
99         '--aircraft=[Select an aircraft profile]:Aircraft:->aircraft' \
100         '--min-status=[Allows you to define a minimum status level for all listed aircraft]:Minimum status level:(alpha beta early-production production)' \
101         '--fdm=[Select the core flight dynamics model]:Core flight dynamics model:(jsb larcsim yasim magic balloon ada external)' \
102         '--aero=[Select aircraft aerodynamics model to load]' \
103         '--model-hz=[Run the FDM this rate (iterations per second)]' \
104         '--speed=[Run the FDM n times faster than real time]' \
105         '--aircraft-dir=[Aircraft directory relative to the path of the executable]:Aircraft directory:_directories' \
106         '--timeofday=[Specify a time of day]:Time of day:(real dawn morning noon afternoon dusk evening midnight)' \
107         '--time-offset=[Add this time offset (+/-hh:mm:ss)]' \
108         '--start-date-sys=[Specify a starting date/time with respect to system time (yyyy:mm:dd:hh:mm:ss)]' \
109         '--start-date-gmt=[Specify a starting date/time with respect to Greenwich Mean Time (yyyy:mm:dd:hh:mm:ss)]' \
110         '--start-date-lat=[Specify a starting date/time with respect to Local Aircraft Time (yyyy:mm:dd:hh:mm:ss)]' \
111         '--airport=[Specify starting position relative to an airport]:Airport:->airport' \
112         '--runway=[Specify starting runway (must also specify an airport)]:Runway:->runway' \
113         '--carrier=[Specify starting position on an AI carrier]:AI carrier:(Nimitz Eisenhower Foch)' \
114         '--parkpos=[Specify which starting position on an AI carrier]:Park position:->parkpos' \
115         '--vor=[Specify starting position relative to a VOR]:VOR:->vor' \
116         '--ndb=[Specify starting position relative to an NDB]:NDB:->ndb' \
117         '--fix=[Specify starting position relative to a fix]:FIX:->fix' \
118         '--offset-distance=[Specify distance to reference point (in miles)]' \
119         '--offset-azimuth=[Specify heading to reference point (in degrees)]' \
120         '--lon=[Starting longitude (in degrees)]' \
121         '--lat=[Starting latitude (in degrees)]' \
122         '--altitude=[Starting altitude]' \
123         '--heading=[Specify heading (yaw) angle (Psi)]' \
124         '--roll=[Specify roll angle (Phi)]' \
125         '--pitch=[Specify pitch angle (Theta)]' \
126         '--uBody=[Specify velocity along the body X axis]' \
127         '--vBody=[Specify velocity along the body Y axis]' \
128         '--wBody=[Specify velocity along the body Z axis]' \
129         '--vc=[Specify initial airspeed (in knots)]' \
130         '--mach=[Specify initial mach number]' \
131         '--glideslope=[Specify flight path angle (in degrees)]' \
132         '--roc=[Specify initial climb rate]' \
133         '--wp=[Specify a waypoint for the GC autopilot]' \
134         '--flight-plan=[Read all waypoints from a file]:Waypoints file:_files' \
135         '--nav1=[Set the NAV1 radio frequency, optionally preceded by a radial]' \
136         '--nav2=[Set the NAV2 radio frequency, optionally preceded by a radial]' \
137         '--adf=[Set the ADF radio frequency, optionally preceded by a card rotation]' \
138         '--dme=[Slave the ADF to one of the NAV radios, or set its internal frequency]' \
139         '--visibility=[Specify initial visibility (in meters)]' \
140         '--visibility-miles=[Specify initial visibility (in miles)]' \
141         '--wind=[Specify wind coming from DIR (degrees) - SPEED (knots) - (DIR@SPEED)]' \
142         '--turbulence=[Specify turbulence from 0.0 (calm) to 1.0 (severe)]' \
143         '--ceiling=[Create an overcast ceiling, optionally with a specific thickness]' \
144         '--multiplay=[Specify multipilot communication settings ({in|out},hz,address,port)]' \
145         '--proxy=[Specify which proxy server (and port) to use (user:pwd@host:port)]' \
146         '--httpd=[Enable http server on the specified port]' \
147         '--telnet=[Enable telnet server on the specified port]' \
148         '--jpg-httpd=[Enable screen shot http server on the specified port]' \
149         '--generic=[Open connection using a predefined communication interface]' \
150         '--garmin=[Open connection using the Garmin GPS protocol]' \
151         '--joyclient=[Open connection to an Agwagon joystick]' \
152         '--jsclient=[Open connection to a remote joystick]' \
153         '--native-ctrls=[Open connection using the FG Native Controls protocol]' \
154         '--native-fdm=[Open connection using the FG Native FDM protocol]' \
155         '--native=[Open connection using the FG Native protocol]' \
156         '--nmea=[Open connection using the NMEA protocol]' \
157         '--opengc=[Open connection using the OpenGC protocol]' \
158         '--props=[Open connection using the interactive property manager]' \
159         '--pve=[Open connection using the PVE protocol]' \
160         '--ray=[Open connection using the Ray Woodworth motion chair protocol]' \
161         '--rul=[Open connection using the RUL protocol]' \
162         '--log-level=[Specify which loggin level to use]:Log level:(bulk debug info warn alert)' \
163         '--trace-read=[Trace the reads for a property]' \
164         '--trace-write=[Trace the writes for a property]' \
165         '--season=[Specify the startup season]:Season:(summer winter)' \
166         '--vehicle=[Select a vehicle profile]:Vehicle:->vehicle' \
167         '--prop:[]'
168 )
169
170
171 _fgfs_ai_scenario() {
172         local i
173         local result
174
175         if ! zstyle -a ":completion:${curcontext}:" fgfs ai_scenario; then
176                 (( $+_cache_ai_scenario )) ||
177                         for i in $_fgfs_root/AI/*.xml; do
178                                 i=${i%.xml}
179                                 _cache_ai_scenario+=( ${i##*/} )
180                         done
181                 result=( "$_cache_ai_scenario[@]" )
182         fi
183
184         compadd -a "$@" - result
185 }
186
187
188 _fgfs_aircraft() {
189         local i
190         local result
191
192         if ! zstyle -a ":completion:${curcontext}:" fgfs aircraft; then
193                 (( $+_cache_aircraft )) ||
194                         for i in $_fgfs_root/Aircraft/*/*-set.xml; do
195                                 i=${i%-set.xml}
196                                 _cache_aircraft+=( ${i##*/} )
197                         done
198
199                 result=( "$_cache_aircraft[@]" )
200         fi
201
202         compadd -a "$@" - result
203 }
204
205
206 _fgfs_airport() {
207         local line
208         local result
209
210         if ! zstyle -a ":completion:${curcontext}:" fgfs airport; then
211                 (( $+_cache_airport )) ||
212                         gunzip -c $_fgfs_root/Airports/apt.dat.gz |
213                                 while read line; do
214                                         if [[ $line = "" ]]; then
215                                                 read line
216                                                 _cache_airport+=( $line[(w)5] )
217                                         fi
218                                 done
219
220                 result=( "$_cache_airport[@]" )
221         fi
222
223         compadd -a "$@" - result
224 }
225
226
227 _fgfs_runway() {
228         local airport
229         local line
230         local result
231
232         [[ $words == *--airport=(#b)([a-zA-Z]#)* ]] && airport=$match[1]
233
234         if [[ $airport = "" ]]; then
235                 _message "Please choose airport !"
236
237                 return
238         fi
239
240         if ! zstyle -a ":completion:${curcontext}:" fgfs runway_$airport; then
241                 (( $+_cache_runway )) ||
242                         gunzip -c $_fgfs_root/Airports/apt.dat.gz |
243                                 while read line; do
244                                         if [[ $line = "" ]]; then
245                                                 read line
246                                                 name=( $line[(w)5] )
247                                                 if [[ $name = $airport ]]; then
248                                                         while read line; do
249                                                                 _cache_runway+=( $line[(w)4] )
250                                                                 break
251                                                         done
252                                                         break
253                                                 fi
254                                         fi
255                                 done
256
257                 _cache_airport_name=$airport
258
259                 result=( "$_cache_runway[@]" );
260         fi
261
262         compadd -a "$@" - result
263 }
264
265
266 _arguments -C -s "$_fgfs_options[@]" && return 0
267
268
269 case $state in
270         ai-scenario)
271                 _fgfs_ai_scenario && return 0
272         ;;
273
274         language)
275         ;;
276
277         aircraft|vehicle)
278                 _fgfs_aircraft && return 0
279         ;;
280
281         airport)
282                 _fgfs_airport && return 0
283         ;;
284
285         runway)
286                 _fgfs_runway && return 0
287         ;;
288
289         parkpos)
290         ;;
291
292         vor)
293         ;;
294
295         ndb)
296         ;;
297
298         fix)
299         ;;
300 esac
301
302