config / .fgfs / _fgfs /
Newer Older
26 lines | 0.674kb
ajout autocompletion zsh pou...
Sébastien MARQUE authored on 2020-04-18
1
#compdef fgfs
2

            
3
local curcontext="$curcontext" state line expl args variant ret=1
4
typeset -A opt_args
5

            
6
# liste des appareils et leur description
7
local aircrafts=(
8
    ${(f)"$(find $FGADDON/Aircraft -maxdepth 2 -type f -name "*-set.xml" -exec grep '<description>' '{}' + \
9
    | sed -r 's|^.+/(.+)-set.xml:.+description>(.+)</description.*$|\1:\2|')"}
10
)
11

            
12
# options de FGFS et leur description
13
args=(
14
    ${(f)"$(sed -rn 's#^[^<]<(.+)-desc>(.+)</.+-desc>#--\1[\2]#p' $FGDIR/source/fgdata/Translations/default/options.xml)"}
15
)
16
args+=('*: :->aircraft')
17

            
18
_arguments -C $args && ret=0
19

            
20
case "$state" in
21
    (aircraft)
22
        _describe 'aircraft' aircrafts
23
    ;;
24
esac
25

            
26
return ret