# cal(1) completion -*- shell-script -*- # Use of this file is deprecated on Linux. Upstream completion is # available in util-linux >= 2.23, use that instead. proc _cal { local cur prev words cword _init_completion || return match $prev { with -m if [[ $OSTYPE == *bsd* ]] { setglobal COMPREPLY = ''( $( compgen -W '{1..12}' -- "$cur" ) ) return } with -s [[ $OSTYPE == *bsd* ]] && return with -A|-B|-d|-H return } if [[ $cur == -* ]] { setglobal COMPREPLY = ''( $( compgen -W '$( _parse_usage "$1" )' -- "$cur" ) ) return } local args _count_args [[ $args -eq 1 ]] && setglobal COMPREPLY = ''( $( compgen -W '{1..12}' -- "$cur" ) ) } && complete -F _cal cal ncal # ex: ts=4 sw=4 et filetype=sh