Add xsltproc completion (Alioth: #311843).

master
Raphaël Droz 2009-12-29 00:10:13 +02:00 committed by Ville Skyttä
parent eee39d7b66
commit 14588b8491
5 changed files with 84 additions and 0 deletions

View File

@ -64,6 +64,9 @@ bash-completion (2.x)
[ Leonard Crestez ]
* Improve ssh -o suboption completion (Alioth: #312122).
[ Raphaël Droz ]
* Add xsltproc completion (Alioth: #311843).
-- David Paleino <d.paleino@gmail.com> Sun, 11 Oct 2009 11:11:57 +0200
bash-completion (1.1)

View File

@ -147,6 +147,7 @@ bashcomp_DATA = contrib/abook \
contrib/xmlwf \
contrib/xmms \
contrib/xrandr \
contrib/xsltproc \
contrib/xz \
contrib/yp-tools \
contrib/yum-arch

57
contrib/xsltproc Normal file
View File

@ -0,0 +1,57 @@
# xsltproc(1) completion
have xsltproc &&
_xsltproc()
{
local cur prev
COMPREPLY=()
cur=`_get_cword`
prev=`_get_pword`
case $prev in
--output|-o)
_filedir
return 0
;;
# TODO : number only
--maxdepth)
return 0
;;
--encoding)
# some aliases removed
COMPREPLY=( $( compgen -W "$( iconv -l | sed -e '/^UTF[1378]/d' \
-e '/^ISO[0-9_]/d' -e '/^8859/d' -e 's/\/.*//')" -- "$cur" ) )
return 0
;;
--param|--stringparam)
return 0
;;
# not really like --writesubtree
--path)
_filedir -d
return 0
;;
--writesubtree)
_filedir -d
return 0
;;
esac
[[ $COMP_CWORD -gt 2 && `_get_cword '' 2` == --?(string)param ]] && \
return 0
if [[ "$cur" == -* ]]; then
_longopt xsltproc
else
_filedir '@(xsl|xslt|xml)'
fi
} &&
complete -F _xsltproc -o filenames xsltproc
# Local variables:
# mode: shell-script
# sh-basic-offset: 4
# sh-indent-comment: t
# indent-tabs-mode: nil
# End:
# ex: ts=4 sw=4 et filetype=sh

View File

@ -0,0 +1,3 @@
if {[assert_bash_type xsltproc]} {
source "lib/completions/xsltproc.exp"
}; # if

View File

@ -0,0 +1,20 @@
proc setup {} {
save_env
}; # setup()
proc teardown {} {
assert_env_unmodified
}; # teardown()
setup
assert_complete_any "xsltproc "
sync_after_int
teardown