]> git.lyx.org Git - lyx.git/blob - lib/scripts/bash_completion
Next patch from Cengiz
[lyx.git] / lib / scripts / bash_completion
1 # lyx(1) completion 
2 # Modified inkscape template of allali@univ-mlv.fr
3 # by cengique@users.sf.net
4
5 have lyx &&
6 _lyx()
7 {
8         local cur g last
9
10         COMPREPLY=()
11         cur=${COMP_WORDS[COMP_CWORD]}
12
13         if [[ $COMP_CWORD > 1 ]]; then
14                 last=${COMP_WORDS[$(($COMP_CWORD - 1))]}
15         else
16                 last=''
17         fi
18
19         # turn on extglob
20         shopt -q extglob && g=1
21         test $g -eq 0 && shopt -s extglob
22
23         if [[ $last == +(--export|-e) ]]; then #'+(--export|-e)'
24                 _filedir '+(pdf[1234]|PDF[1234]|pdf|PDF|ps|PS|xhtml|XHTML)'
25         else
26         case "$cur" in
27         -*)
28                 COMPREPLY=( $( compgen -W '-help -userdir -sysdir \
29                                 -geometry -dbg -x --execute -e --export \
30                                 -i --import -version -batch' -- $cur ) ) ;;
31         *)
32                 _filedir '@(lyx)' 
33         esac
34         fi
35
36         # turn it off if necessary
37         test $g -eq 0 && shopt -u extglob
38
39 }
40 [ "${have:-}" ] && complete -F _lyxz $filenames lyx