2010-02-21 16:50:52 +00:00
|
|
|
# patool completion
|
|
|
|
#
|
|
|
|
have patool &&
|
|
|
|
{
|
|
|
|
_patool()
|
|
|
|
{
|
|
|
|
local cur prev commands options command
|
|
|
|
|
|
|
|
COMPREPLY=()
|
|
|
|
cur=`_get_cword`
|
|
|
|
|
2010-03-12 11:54:17 +00:00
|
|
|
commands='extract list test create diff repack formats'
|
2010-02-21 16:50:52 +00:00
|
|
|
|
|
|
|
if [[ $COMP_CWORD -eq 1 ]] ; then
|
|
|
|
if [[ "$cur" == -* ]]; then
|
|
|
|
COMPREPLY=( $( compgen -W '--help' -- $cur ) )
|
|
|
|
else
|
|
|
|
COMPREPLY=( $( compgen -W "$commands" -- $cur ) )
|
|
|
|
fi
|
|
|
|
else
|
|
|
|
|
|
|
|
command=${COMP_WORDS[1]}
|
|
|
|
|
|
|
|
if [[ "$cur" == -* ]]; then
|
|
|
|
# possible options for the command
|
2010-03-08 17:28:11 +00:00
|
|
|
options=''
|
2010-02-21 16:50:52 +00:00
|
|
|
case $command in
|
2010-03-08 17:28:11 +00:00
|
|
|
extract|list|test|create)
|
2010-02-21 16:50:52 +00:00
|
|
|
options='--verbose'
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
options="$options --help"
|
|
|
|
|
|
|
|
COMPREPLY=( $( compgen -W "$options" -- $cur ) )
|
|
|
|
else
|
|
|
|
_filedir
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
return 0
|
|
|
|
}
|
|
|
|
complete -F _patool $filenames patool
|
|
|
|
|
|
|
|
}
|