interdiff: New completion.

This commit is contained in:
Ville Skyttä 2013-03-16 19:31:38 +02:00
parent e191799dea
commit 796fbbdc86
4 changed files with 53 additions and 0 deletions

View File

@ -135,6 +135,7 @@ bashcomp_DATA = a2x \
inject \
insmod \
installpkg \
interdiff \
invoke-rc.d \
ionice \
ip \

33
completions/interdiff Normal file
View File

@ -0,0 +1,33 @@
# interdiff(1) completion -*- shell-script -*-
_interdiff()
{
local cur prev words cword split
_init_completion -s || return
case $prev in
-U|--unified|-p|--strip-match|-d|--drop-context)
return
;;
esac
$split && return
if [[ $cur == -* ]]; then
COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) )
[[ $COMPREPLY == *= ]] && compopt -o nospace
return
fi
local exts='@(?(d)patch|dif?(f))' word
for word in ${words[@]}; do
if [[ $word == -@(z|-decompress) ]]; then
exts+='?(.@(gz|bz2))'
break
fi
done
_filedir "$exts"
} &&
complete -F _interdiff interdiff
# ex: ts=4 sw=4 et filetype=sh

View File

@ -0,0 +1 @@
assert_source_completions interdiff

View File

@ -0,0 +1,18 @@
proc setup {} {
save_env
}
proc teardown {} {
assert_env_unmodified
}
setup
assert_complete_any "interdiff "
sync_after_int
teardown