cal: New completion.

This commit is contained in:
Ville Skyttä 2011-07-24 13:16:44 +03:00
parent b2add89f4c
commit b1f2402bfd
4 changed files with 62 additions and 0 deletions

View File

@ -16,6 +16,7 @@ bashcomp_DATA = abook \
bluez \
brctl \
bzip2 \
cal \
cardctl \
cfengine \
chkconfig \

40
completions/cal Normal file
View File

@ -0,0 +1,40 @@
have cal || have ncal || return
_cal()
{
local cur prev words cword
_init_completion || return
case $prev in
-m)
if [[ $OSTYPE == *bsd* ]]; then
COMPREPLY=( $( compgen -W '{1..12}' -- "$cur" ) )
return
fi
;;
-s)
[[ $OSTYPE == *bsd* ]] && return
;;
-A|-B|-d|-H)
return
;;
esac
if [[ $cur == -* ]]; then
COMPREPLY=( $( compgen -W '$( _parse_usage "$1" )' -- "$cur" ) )
return
fi
local args
_count_args
[[ $args -eq 1 ]] && COMPREPLY=( $( compgen -W '{1..12}' -- "$cur" ) )
} &&
complete -F _cal cal ncal
# 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

1
test/completion/cal.exp Normal file
View File

@ -0,0 +1 @@
assert_source_completions cal

View File

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