Ville Skyttä 0f450219b6 Remove most "-o filenames" options to "complete".
Turn it on dynamically when needed instead; see doc/styleguide.txt for
a longer explanation.  This fixes many non-filename completions which
had been previously more or less broken due to unwanted
escape-as-filenames behavior.
2010-11-01 19:29:45 +02:00

37 lines
595 B
Bash

# jar(1) completion
have jar &&
_jar()
{
local cur
COMPREPLY=()
_get_comp_words_by_ref cur
if [ $COMP_CWORD = 1 ]; then
COMPREPLY=( $( compgen -W 'c t x u' -- "$cur" ) )
return 0
fi
case ${COMP_WORDS[1]} in
*c*f)
_filedir
;;
*f)
_filedir '@([ejw]ar|zip)'
;;
*)
_filedir
;;
esac
} &&
complete -F _jar jar
# 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