# sitecopy(1) completion -*- shell-script -*- # Copyright 2003 Eelco Lempsink # 2011 Raphaƫl Droz # License: GNU GPL v2 or later proc _sitecopy { var cur = '', prev = '', words = '', cword = '', split = '' _init_completion -s || return match $prev { with --debug|-d setglobal COMPREPLY = '( '$( compgen -W "socket files rcfile ftp http httpbody rsh sftp xml xmlparse cleartext" -- "$cur" ) ) compopt -o nospace return 0 with --logfile|-g|--rcfile|-r _filedir return 0 with --storepath|-p _filedir -d return 0 } match $cur { with --* setglobal COMPREPLY = '( '$( compgen -W "$(_parse_help $1)" -- "$cur" ) ) [[ $COMPREPLY == *= ]] && compopt -o nospace return 0 # only complete long options with - compopt -o nospace setglobal COMPREPLY = '( '-- ) return 0 } if [[ -r ~/.sitecopyrc ]] { setglobal COMPREPLY = '( '$( compgen -W "$($1 -v | \ command sed -n '/^Site:/s/Site: //p')" -- "$cur" ) ) } return 0 } && complete -F _sitecopy -o default sitecopy # ex: ts=4 sw=4 et filetype=sh