... | ... |
@@ -265,6 +265,53 @@ function fgfs () { |
265 | 265 |
$FGDIR/install/flightgear/bin/fgfs $fgfs_arg ${complement[$fgfs_arg]} 2>/dev/null | pager |
266 | 266 |
return |
267 | 267 |
;; |
268 |
+ --info) |
|
269 |
+ local PS3='which aircraft ? ' |
|
270 |
+ local IFS=$'\n' |
|
271 |
+ function _info () { |
|
272 |
+ local _info=$(sqlite3 $FGADDON/fgaddon.db <<< "select \`$1\` |
|
273 |
+ from setxml |
|
274 |
+ inner join aircrafts, hangars |
|
275 |
+ where |
|
276 |
+ aircrafts.hangar = hangars.id |
|
277 |
+ and |
|
278 |
+ setxml.variantof = aircrafts.id |
|
279 |
+ and |
|
280 |
+ setxml.file = '$file' |
|
281 |
+ and |
|
282 |
+ hangars.name = '${${(@s/ /)ac}[2]:1:-1}'") |
|
283 |
+ if test -n "$_info"; then |
|
284 |
+ printf "%s: %s\n" "$2" "$_info" |
|
285 |
+ fi |
|
286 |
+ } |
|
287 |
+ select ac in $(sqlite3 $FGADDON/fgaddon.db <<< "select distinct printf('%s [%s, %s]', |
|
288 |
+ aircrafts.name, |
|
289 |
+ hangars.name, |
|
290 |
+ date(aircrafts.date, 'unixepoch')) |
|
291 |
+ from aircrafts |
|
292 |
+ inner join setxml, hangars |
|
293 |
+ where |
|
294 |
+ aircrafts.hangar = hangars.id |
|
295 |
+ and |
|
296 |
+ setxml.variantof = aircrafts.id |
|
297 |
+ and |
|
298 |
+ setxml.file = '$2' |
|
299 |
+ order by aircrafts.date desc"); do |
|
300 |
+ test -z "$ac" && continue |
|
301 |
+ local file=$2 |
|
302 |
+ _info /sim/description "Short description" |
|
303 |
+ _info /sim/long-description "Long description" |
|
304 |
+ _info /sim/author "Author(s)" |
|
305 |
+ _info /sim/flight-model "Flight model" |
|
306 |
+ _info /sim/type "Type" |
|
307 |
+ echo Ratings |
|
308 |
+ for r in FDM systems cockpit model; do |
|
309 |
+ _info /sim/rating/$r " $r" |
|
310 |
+ done |
|
311 |
+ return |
|
312 |
+ done |
|
313 |
+ return |
|
314 |
+ ;; |
|
268 | 315 |
--show-thumbnail) |
269 | 316 |
local PS3='which aircraft ? ' |
270 | 317 |
local IFS=$'\n' |