[Bash-completion-devel] xsltproc completion

Raph gibboris at gmail.com
Sun May 24 22:05:43 UTC 2009


Hello,
a quick attempt to make the
completion of xsltproc.
See attachement.

Raph
-------------- next part --------------
have xsltproc && {
_xsltproc()
{
        local cur prev
        COMPREPLY=()
        cur=`_get_cword`
        prev=${COMP_WORDS[COMP_CWORD-1]}

	case $prev in
	 	-@(-output|o))
			_filedir
			return 0
		;;
		# TODO : number only
	 	--maxdepth)
			return 0
		;;
		--encoding)
			COMPREPLY=( $(compgen -W "$(localedef --list-archive)" -- "$cur" ))
			return 0
		;;
		--@(?(string)param))
			return 0
		;;

		# not really like --writesubtree
		--path)
			_filedir -d
			return 0
		;;
	 	--writesubtree)
			_filedir -d
			return 0
		;;

	esac

	if [[ "$cur" == -* ]]; then
		COMPREPLY=( $( compgen -W "--catalogs --debug --dumpextensions --html --load-trace \
				--maxdepth --nodtdattr --nomkdir --nonet --noout --novalid \
				--nowrite --output -o --encoding --param --path --profile \
				--norman --repeat --stringparam --timing --verbose -v \
				--version -V --writesubtree --xinclude" -- $cur ) )
	else
		_filedir '@(xsl?(t)|xml)'
	fi
} &&
complete -F _xsltproc xsltproc
}


More information about the Bash-completion-devel mailing list