40 lines
1.0 KiB
Plaintext
Raw Normal View History

# sitecopy(1) completion
# Copyright 2003 Eelco Lempsink <eelcolempsink@gmx.net>
# License: GNU GPL v2 or later
2003-12-31 07:22:37 +00:00
have sitecopy || return
_sitecopy()
{
local cur prev words cword
_init_completion || return
case $cur in
2009-10-04 19:42:50 +02:00
--*)
COMPREPLY=( $( compgen -W "$(sitecopy -h | command grep -e '--\w' |\
2009-10-04 19:42:50 +02:00
awk '{sub (/=(FILE|PATH)/, "", $2); print $2}')" -- "$cur" ) )
;;
-*)
COMPREPLY=( $( compgen -W "$(sitecopy -h | command grep -e '-\w' | \
2009-10-04 19:42:50 +02:00
awk '{sub (",", "", $1); print $1}')" -- "$cur" ) )
;;
*)
if [ -r ~/.sitecopyrc ]; then
COMPREPLY=( $( compgen -W "$(command grep '^["$'\t '"]*site' \
2009-10-04 19:42:50 +02:00
~/.sitecopyrc | awk '{print $2}')" -- "$cur" ) )
fi
;;
esac
2009-10-04 19:42:50 +02:00
return 0
2009-06-08 21:22:43 +03:00
} &&
complete -F _sitecopy -o default sitecopy
# Local variables:
# mode: shell-script
2009-10-04 19:42:50 +02:00
# sh-basic-offset: 4
# sh-indent-comment: t
2009-10-04 19:42:50 +02:00
# indent-tabs-mode: nil
# End:
2009-10-04 19:42:50 +02:00
# ex: ts=4 sw=4 et filetype=sh