2003-12-10 01:20:38 +00:00
|
|
|
# sitecopy(1) completion
|
|
|
|
# Copyright 2003 Eelco Lempsink <eelcolempsink@gmx.net>
|
|
|
|
# License: GNU GPL v2 or later
|
2003-12-31 07:22:37 +00:00
|
|
|
|
2011-04-05 00:35:51 +03:00
|
|
|
have sitecopy || return
|
|
|
|
|
2003-12-10 01:20:38 +00:00
|
|
|
_sitecopy()
|
|
|
|
{
|
2011-04-21 11:04:51 +03:00
|
|
|
local cur prev words cword
|
|
|
|
_init_completion || return
|
2003-12-10 01:20:38 +00:00
|
|
|
|
2009-12-30 00:39:59 +01:00
|
|
|
case $cur in
|
2009-10-04 19:42:50 +02:00
|
|
|
--*)
|
2009-12-15 23:48:10 +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" ) )
|
|
|
|
;;
|
|
|
|
-*)
|
2009-12-15 23:48:10 +02:00
|
|
|
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
|
2009-12-15 23:48:10 +02:00
|
|
|
COMPREPLY=( $( compgen -W "$(command grep '^["$'\t '"]*site' \
|
2009-10-04 19:42:50 +02:00
|
|
|
~/.sitecopyrc | awk '{print $2}')" -- "$cur" ) )
|
|
|
|
fi
|
|
|
|
;;
|
|
|
|
esac
|
2003-12-10 01:20:38 +00:00
|
|
|
|
2009-10-04 19:42:50 +02:00
|
|
|
return 0
|
2009-06-08 21:22:43 +03:00
|
|
|
} &&
|
2009-10-22 12:04:29 +03:00
|
|
|
complete -F _sitecopy -o default sitecopy
|
2009-10-01 20:54:51 +03:00
|
|
|
|
|
|
|
# Local variables:
|
|
|
|
# mode: shell-script
|
2009-10-04 19:42:50 +02:00
|
|
|
# sh-basic-offset: 4
|
2009-10-01 20:54:51 +03:00
|
|
|
# sh-indent-comment: t
|
2009-10-04 19:42:50 +02:00
|
|
|
# indent-tabs-mode: nil
|
2009-10-01 20:54:51 +03:00
|
|
|
# End:
|
2009-10-04 19:42:50 +02:00
|
|
|
# ex: ts=4 sw=4 et filetype=sh
|