]> git.mxchange.org Git - flightgear.git/blob - scripts/completion/fg-completion.zsh
nasal.vim: add getAliasTarget clearValue, values, io.flush
[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         '--control=[Primary control mode]:Primary control mode:(joystick keyboard mouse)' \
91         '--browser-app=[Specify path to your web browser]:Directories:_directories' \
92         '--config=[Load additional properties from path]' \
93         '--failure=[Fail the pitot, static, vacuum, or electrical system]:Failure system:(pitot static vaccum electical)'
94         '--bpp=[Specify the bits per pixel]' \
95         '--fov=[Specify field of view angle]' \
96         '--callsign=[Assign a unique name to a player]' \
97         '--aspect-ratio-multiplier=[Specify a multiplier for the aspect ratio]' \
98         '--geometry=[Specify window geometry (640x480, etc)]' \
99         '--view-offset=[Specify the default forward view direction as an offset from straight ahead]' \
100         '--aircraft=[Select an aircraft profile]:Aircraft:->aircraft' \
101         '--min-status=[Allows you to define a minimum status level for all listed aircraft]:Minimum status level:(alpha beta early-production production)' \
102         '--fdm=[Select the core flight dynamics model]:Core flight dynamics model:(jsb larcsim yasim magic balloon ada external)' \
103         '--aero=[Select aircraft aerodynamics model to load]' \
104         '--model-hz=[Run the FDM this rate (iterations per second)]' \
105         '--speed=[Run the FDM n times faster than real time]' \
106         '--aircraft-dir=[Aircraft directory relative to the path of the executable]:Aircraft directory:_directories' \
107         '--timeofday=[Specify a time of day]:Time of day:(real dawn morning noon afternoon dusk evening midnight)' \
108         '--time-offset=[Add this time offset (+/-hh:mm:ss)]' \
109         '--start-date-sys=[Specify a starting date/time with respect to system time (yyyy:mm:dd:hh:mm:ss)]' \
110         '--start-date-gmt=[Specify a starting date/time with respect to Greenwich Mean Time (yyyy:mm:dd:hh:mm:ss)]' \
111         '--start-date-lat=[Specify a starting date/time with respect to Local Aircraft Time (yyyy:mm:dd:hh:mm:ss)]' \
112         '--airport=[Specify starting position relative to an airport]:Airport:->airport' \
113         '--runway=[Specify starting runway (must also specify an airport)]:Runway:->runway' \
114         '--carrier=[Specify starting position on an AI carrier]:AI carrier:(Nimitz Eisenhower Foch)' \
115         '--parkpos=[Specify which starting position on an AI carrier]:Park position:->parkpos' \
116         '--vor=[Specify starting position relative to a VOR]:VOR:->vor' \
117         '--ndb=[Specify starting position relative to an NDB]:NDB:->ndb' \
118         '--fix=[Specify starting position relative to a fix]:FIX:->fix' \
119         '--offset-distance=[Specify distance to reference point (in miles)]' \
120         '--offset-azimuth=[Specify heading to reference point (in degrees)]' \
121         '--lon=[Starting longitude (in degrees)]' \
122         '--lat=[Starting latitude (in degrees)]' \
123         '--altitude=[Starting altitude]' \
124         '--heading=[Specify heading (yaw) angle (Psi)]' \
125         '--roll=[Specify roll angle (Phi)]' \
126         '--pitch=[Specify pitch angle (Theta)]' \
127         '--uBody=[Specify velocity along the body X axis]' \
128         '--vBody=[Specify velocity along the body Y axis]' \
129         '--wBody=[Specify velocity along the body Z axis]' \
130         '--vc=[Specify initial airspeed (in knots)]' \
131         '--mach=[Specify initial mach number]' \
132         '--glideslope=[Specify flight path angle (in degrees)]' \
133         '--roc=[Specify initial climb rate]' \
134         '--wp=[Specify a waypoint for the GC autopilot]' \
135         '--flight-plan=[Read all waypoints from a file]:Waypoints file:_files' \
136         '--nav1=[Set the NAV1 radio frequency, optionally preceded by a radial]' \
137         '--nav2=[Set the NAV2 radio frequency, optionally preceded by a radial]' \
138         '--adf=[Set the ADF radio frequency, optionally preceded by a card rotation]' \
139         '--dme=[Slave the ADF to one of the NAV radios, or set its internal frequency]' \
140         '--visibility=[Specify initial visibility (in meters)]' \
141         '--visibility-miles=[Specify initial visibility (in miles)]' \
142         '--wind=[Specify wind coming from DIR (degrees) - SPEED (knots) - (DIR@SPEED)]' \
143         '--turbulence=[Specify turbulence from 0.0 (calm) to 1.0 (severe)]' \
144         '--ceiling=[Create an overcast ceiling, optionally with a specific thickness]' \
145         '--multiplay=[Specify multipilot communication settings ({in|out},hz,address,port)]' \
146         '--proxy=[Specify which proxy server (and port) to use (user:pwd@host:port)]' \
147         '--httpd=[Enable http server on the specified port]' \
148         '--telnet=[Enable telnet server on the specified port]' \
149         '--jpg-httpd=[Enable screen shot http server on the specified port]' \
150         '--generic=[Open connection using a predefined communication interface]' \
151         '--garmin=[Open connection using the Garmin GPS protocol]' \
152         '--joyclient=[Open connection to an Agwagon joystick]' \
153         '--jsclient=[Open connection to a remote joystick]' \
154         '--native-ctrls=[Open connection using the FG Native Controls protocol]' \
155         '--native-fdm=[Open connection using the FG Native FDM protocol]' \
156         '--native=[Open connection using the FG Native protocol]' \
157         '--nmea=[Open connection using the NMEA protocol]' \
158         '--opengc=[Open connection using the OpenGC protocol]' \
159         '--props=[Open connection using the interactive property manager]' \
160         '--pve=[Open connection using the PVE protocol]' \
161         '--ray=[Open connection using the Ray Woodworth motion chair protocol]' \
162         '--rul=[Open connection using the RUL protocol]' \
163         '--log-level=[Specify which loggin level to use]:Log level:(bulk debug info warn alert)' \
164         '--trace-read=[Trace the reads for a property]' \
165         '--trace-write=[Trace the writes for a property]' \
166         '--season=[Specify the startup season]:Season:(summer winter)' \
167         '--vehicle=[Select a vehicle profile]:Vehicle:->vehicle' \
168         '--prop:[]'
169 )
170
171
172 _fgfs_ai_scenario() {
173         local i
174         local result
175
176         if ! zstyle -a ":completion:${curcontext}:" fgfs ai_scenario; then
177                 (( $+_cache_ai_scenario )) ||
178                         for i in $_fgfs_root/AI/*.xml; do
179                                 i=${i%.xml}
180                                 _cache_ai_scenario+=( ${i##*/} )
181                         done
182                 result=( "$_cache_ai_scenario[@]" )
183         fi
184
185         compadd -a "$@" - result
186 }
187
188
189 _fgfs_aircraft() {
190         local i
191         local result
192
193         if ! zstyle -a ":completion:${curcontext}:" fgfs aircraft; then
194                 (( $+_cache_aircraft )) ||
195                         for i in $_fgfs_root/Aircraft/*/*-set.xml; do
196                                 i=${i%-set.xml}
197                                 _cache_aircraft+=( ${i##*/} )
198                         done
199
200                 result=( "$_cache_aircraft[@]" )
201         fi
202
203         compadd -a "$@" - result
204 }
205
206
207 _fgfs_airport() {
208         local line
209         local result
210
211         if ! zstyle -a ":completion:${curcontext}:" fgfs airport; then
212                 (( $+_cache_airport )) ||
213                         gunzip -c $_fgfs_root/Airports/apt.dat.gz |
214                                 while read line; do
215                                         if [[ $line = "" ]]; then
216                                                 read line
217                                                 _cache_airport+=( $line[(w)5] )
218                                         fi
219                                 done
220
221                 result=( "$_cache_airport[@]" )
222         fi
223
224         compadd -a "$@" - result
225 }
226
227
228 _fgfs_runway() {
229         local airport
230         local line
231         local result
232
233         [[ $words == *--airport=(#b)([a-zA-Z]#)* ]] && airport=$match[1]
234
235         if [[ $airport = "" ]]; then
236                 _message "Please choose airport !"
237
238                 return
239         fi
240
241         if ! zstyle -a ":completion:${curcontext}:" fgfs runway_$airport; then
242                 (( $+_cache_runway )) ||
243                         gunzip -c $_fgfs_root/Airports/apt.dat.gz |
244                                 while read line; do
245                                         if [[ $line = "" ]]; then
246                                                 read line
247                                                 name=( $line[(w)5] )
248                                                 if [[ $name = $airport ]]; then
249                                                         while read line; do
250                                                                 _cache_runway+=( $line[(w)4] )
251                                                                 break
252                                                         done
253                                                         break
254                                                 fi
255                                         fi
256                                 done
257
258                 _cache_airport_name=$airport
259
260                 result=( "$_cache_runway[@]" );
261         fi
262
263         compadd -a "$@" - result
264 }
265
266
267 _arguments -C -s "$_fgfs_options[@]" && return 0
268
269
270 case $state in
271         ai-scenario)
272                 _fgfs_ai_scenario && return 0
273         ;;
274
275         language)
276         ;;
277
278         aircraft|vehicle)
279                 _fgfs_aircraft && return 0
280         ;;
281
282         airport)
283                 _fgfs_airport && return 0
284         ;;
285
286         runway)
287                 _fgfs_runway && return 0
288         ;;
289
290         parkpos)
291         ;;
292
293         vor)
294         ;;
295
296         ndb)
297         ;;
298
299         fix)
300         ;;
301 esac
302
303