2011-11-01 22:14:45 +02:00
|
|
|
# bash completion for rsync -*- shell-script -*-
|
2009-05-21 01:33:48 +02:00
|
|
|
|
|
|
|
_rsync()
|
|
|
|
{
|
2011-05-01 22:18:40 +03:00
|
|
|
local cur prev words cword split
|
|
|
|
_init_completion -s -n : || return
|
2009-05-21 01:33:48 +02:00
|
|
|
|
2009-10-04 19:42:50 +02:00
|
|
|
_expand || return 0
|
2009-05-21 01:33:48 +02:00
|
|
|
|
2009-12-30 00:39:59 +01:00
|
|
|
case $prev in
|
2011-04-22 11:42:17 +03:00
|
|
|
--config|--password-file|--include-from|--exclude-from|--files-from|\
|
|
|
|
--log-file|--write-batch|--only-write-batch|--read-batch)
|
|
|
|
compopt +o nospace
|
2009-12-22 20:37:53 +02:00
|
|
|
_filedir
|
|
|
|
return 0
|
|
|
|
;;
|
2011-04-22 11:42:17 +03:00
|
|
|
-T|--temp-dir|--compare-dest|--backup-dir|--partial-dir|--copy-dest|\
|
|
|
|
--link-dest)
|
|
|
|
compopt +o nospace
|
2009-12-22 20:37:53 +02:00
|
|
|
_filedir -d
|
|
|
|
return 0
|
|
|
|
;;
|
|
|
|
-e|--rsh)
|
2011-04-22 11:42:17 +03:00
|
|
|
compopt +o nospace
|
2009-12-22 20:37:53 +02:00
|
|
|
COMPREPLY=( $( compgen -W 'rsh ssh' -- "$cur" ) )
|
|
|
|
return 0
|
|
|
|
;;
|
2009-12-22 20:53:30 +02:00
|
|
|
--compress-level)
|
2011-04-22 11:42:17 +03:00
|
|
|
compopt +o nospace
|
2011-04-25 23:44:08 +03:00
|
|
|
COMPREPLY=( $( compgen -W '{1..9}' -- "$cur" ) )
|
2009-12-22 20:53:30 +02:00
|
|
|
return 0
|
|
|
|
;;
|
2009-10-04 19:42:50 +02:00
|
|
|
esac
|
2009-05-21 01:33:48 +02:00
|
|
|
|
2011-04-24 18:50:40 +03:00
|
|
|
$split && return 0
|
|
|
|
|
2009-12-30 00:39:59 +01:00
|
|
|
case $cur in
|
2009-12-22 20:37:53 +02:00
|
|
|
-*)
|
2013-02-17 23:49:30 +02:00
|
|
|
COMPREPLY=( $( compgen -W '--verbose --quiet --no-motd --checksum
|
|
|
|
--archive --recursive --relative --no-implied-dirs
|
|
|
|
--backup --backup-dir= --suffix= --update --inplace --append
|
|
|
|
--append-verify --dirs --old-dirs --links --copy-links
|
|
|
|
--copy-unsafe-links --safe-links --copy-dirlinks
|
|
|
|
--keep-dirlinks --hard-links --perms --executability --chmod=
|
|
|
|
--acls --xattrs --owner --group --devices --copy-devices
|
|
|
|
--specials --times --omit-dir-times --super --fake-super
|
|
|
|
--sparse --dry-run --whole-file --no-whole-file
|
|
|
|
--one-file-system --block-size= --rsh= --rsync-path=
|
|
|
|
--existing --ignore-existing --remove-source-files --delete
|
|
|
|
--delete-before --delete-during --delete-delay --delete-after
|
|
|
|
--delete-excluded --ignore-errors --force --max-delete=
|
|
|
|
--max-size= --min-size= --partial --partial-dir=
|
|
|
|
--delay-updates --prune-empty-dirs --numeric-ids --timeout=
|
|
|
|
--contimeout= --ignore-times --size-only --modify-window=
|
|
|
|
--temp-dir= --fuzzy --compare-dest= --copy-dest= --link-dest=
|
|
|
|
--compress --compress-level= --skip-compress= --cvs-exclude
|
|
|
|
--filter= --exclude= --exclude-from= --include= --include-from=
|
|
|
|
--files-from= --from0 --protect-args --address= --port=
|
|
|
|
--sockopts= --blocking-io --no-blocking-io --stats
|
|
|
|
--8-bit-output --human-readable --progress --itemize-changes
|
|
|
|
--out-format= --log-file= --log-file-format= --password-file=
|
|
|
|
--list-only --bwlimit= --write-batch= --only-write-batch=
|
|
|
|
--read-batch= --protocol= --iconv= --ipv4 --ipv6 --version
|
|
|
|
--help --daemon --config= --no-detach' -- "$cur" ) )
|
2011-04-27 15:46:27 +03:00
|
|
|
[[ $COMPREPLY == *= ]] || compopt +o nospace
|
2009-12-22 20:37:53 +02:00
|
|
|
;;
|
|
|
|
*:*)
|
2011-10-13 21:15:05 +03:00
|
|
|
# find which remote shell is used
|
|
|
|
local i shell=ssh
|
|
|
|
for (( i=1; i < cword; i++ )); do
|
|
|
|
if [[ "${words[i]}" == -@(e|-rsh) ]]; then
|
|
|
|
shell=${words[i+1]}
|
|
|
|
break
|
|
|
|
fi
|
|
|
|
done
|
2011-11-09 23:28:11 +02:00
|
|
|
[[ $shell == ssh ]] && _xfunc ssh _scp_remote_files
|
2009-12-22 20:37:53 +02:00
|
|
|
;;
|
|
|
|
*)
|
|
|
|
_known_hosts_real -c -a "$cur"
|
2011-10-13 21:15:05 +03:00
|
|
|
_xfunc ssh _scp_local_files
|
2009-12-22 20:37:53 +02:00
|
|
|
;;
|
2009-10-04 19:42:50 +02:00
|
|
|
esac
|
2009-05-21 01:33:48 +02:00
|
|
|
|
2009-10-04 19:42:50 +02:00
|
|
|
return 0
|
2009-05-21 01:33:48 +02:00
|
|
|
} &&
|
2009-12-25 12:30:01 +02:00
|
|
|
complete -F _rsync -o nospace rsync
|
2009-10-01 20:54:51 +03:00
|
|
|
|
2009-10-04 19:42:50 +02:00
|
|
|
# ex: ts=4 sw=4 et filetype=sh
|