1 contributor
#compdef fgfs
local curcontext="$curcontext" state line expl args variant ret=1
typeset -A opt_args
# liste des appareils et leur description
local aircrafts=(
${(f)"$(find $FGADDON/Aircraft -maxdepth 2 -type f -name "*-set.xml" -exec grep '<description>' '{}' + \
| sed -r 's|^.+/(.+)-set.xml:.+description>(.+)</description.*$|\1:\2|')"}
)
# options de FGFS et leur description
args=(
${(f)"$(sed -rn 's#^[^<]<(.+)-desc>(.+)</.+-desc>#--\1[\2]#p' $FGDIR/source/fgdata/Translations/default/options.xml)"}
)
args+=('*: :->aircraft')
_arguments -C $args && ret=0
case "$state" in
(aircraft)
_describe 'aircraft' aircrafts
;;
esac
return ret