cal: New completion.
This commit is contained in:
parent
b2add89f4c
commit
b1f2402bfd
@ -16,6 +16,7 @@ bashcomp_DATA = abook \
|
|||||||
bluez \
|
bluez \
|
||||||
brctl \
|
brctl \
|
||||||
bzip2 \
|
bzip2 \
|
||||||
|
cal \
|
||||||
cardctl \
|
cardctl \
|
||||||
cfengine \
|
cfengine \
|
||||||
chkconfig \
|
chkconfig \
|
||||||
|
40
completions/cal
Normal file
40
completions/cal
Normal 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
1
test/completion/cal.exp
Normal file
@ -0,0 +1 @@
|
|||||||
|
assert_source_completions cal
|
20
test/lib/completions/cal.exp
Normal file
20
test/lib/completions/cal.exp
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
proc setup {} {
|
||||||
|
save_env
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
proc teardown {} {
|
||||||
|
assert_env_unmodified
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
setup
|
||||||
|
|
||||||
|
|
||||||
|
assert_complete_any "cal "
|
||||||
|
|
||||||
|
|
||||||
|
sync_after_int
|
||||||
|
|
||||||
|
|
||||||
|
teardown
|
Loading…
x
Reference in New Issue
Block a user