mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-25 02:49:46 +00:00
New version of bash_completion from Cengiz Günay.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@34067 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
8043c693e2
commit
eb4786c80d
@ -1,40 +1,59 @@
|
|||||||
# lyx(1) completion
|
# lyx(1) completion
|
||||||
# Modified inkscape template of allali@univ-mlv.fr
|
# Copyleft 2010 Cengiz Gunay <cengique@users.sf.net>
|
||||||
# by cengique@users.sf.net
|
|
||||||
|
|
||||||
have lyx &&
|
have lyx &&
|
||||||
_lyx()
|
_lyx()
|
||||||
{
|
{
|
||||||
local cur g last
|
local cur g last
|
||||||
|
|
||||||
|
# turn on extglob
|
||||||
|
shopt -q extglob && g=1
|
||||||
|
test $g -eq 0 && shopt -s extglob
|
||||||
|
|
||||||
COMPREPLY=()
|
COMPREPLY=()
|
||||||
cur=${COMP_WORDS[COMP_CWORD]}
|
cur=${COMP_WORDS[COMP_CWORD]}
|
||||||
|
|
||||||
|
local dbg_cmds=( "none info init key gui \
|
||||||
|
parser lyxrc kbmap latex mathed font tclass \
|
||||||
|
lyxvc lyxserver roff action lyxlex depend insets \
|
||||||
|
files workarea insettext graphics changes \
|
||||||
|
external painting debug any" )
|
||||||
|
|
||||||
|
#echo "cmds: '$dbg_cmds'"
|
||||||
|
|
||||||
if [[ $COMP_CWORD > 1 ]]; then
|
if [[ $COMP_CWORD > 1 ]]; then
|
||||||
last=${COMP_WORDS[$(($COMP_CWORD - 1))]}
|
last=${COMP_WORDS[$(($COMP_CWORD - 1))]}
|
||||||
else
|
else
|
||||||
last=''
|
last=''
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# turn on extglob
|
case "$last" in
|
||||||
shopt -q extglob && g=1
|
+\(--export|-e\))
|
||||||
test $g -eq 0 && shopt -s extglob
|
_filedir '+(pdf[1234]|PDF[1234]|pdf|PDF|ps|PS|xhtml|XHTML)';;
|
||||||
|
-dbg)
|
||||||
if [[ $last == +(--export|-e) ]]; then #'+(--export|-e)'
|
# check for multiple debug commands
|
||||||
_filedir '+(pdf[1234]|PDF[1234]|pdf|PDF|ps|PS|xhtml|XHTML)'
|
if [[ $cur == *,* ]]; then #
|
||||||
else
|
COMPREPLY=( $( compgen -W '$dbg_cmds' \
|
||||||
case "$cur" in
|
-P ${cur%,*}, -- ${cur##*,} ) )
|
||||||
-*)
|
else
|
||||||
|
COMPREPLY=( $( compgen -W '$dbg_cmds' -- $cur ) )
|
||||||
|
fi;;
|
||||||
|
*)
|
||||||
|
case "$cur" in
|
||||||
|
-*)
|
||||||
|
# LyX command line options
|
||||||
COMPREPLY=( $( compgen -W '-help -userdir -sysdir \
|
COMPREPLY=( $( compgen -W '-help -userdir -sysdir \
|
||||||
-geometry -dbg -x --execute -e --export \
|
-geometry -dbg -x --execute -e --export \
|
||||||
-i --import -version -batch' -- $cur ) ) ;;
|
-i --import -version -batch ' -- $cur ) ) ;;
|
||||||
*)
|
|
||||||
|
*)
|
||||||
|
# LyX files
|
||||||
_filedir '@(lyx)'
|
_filedir '@(lyx)'
|
||||||
esac
|
esac
|
||||||
fi
|
esac
|
||||||
|
|
||||||
# turn it off if necessary
|
# turn it off if necessary
|
||||||
test $g -eq 0 && shopt -u extglob
|
test $g -eq 0 && shopt -u extglob
|
||||||
|
|
||||||
}
|
}
|
||||||
[ "${have:-}" ] && complete -F _lyxz $filenames lyx
|
[ "${have:-}" ] && complete -F _lyx $filenames lyx
|
||||||
|
Loading…
Reference in New Issue
Block a user