[Bash-completion-commits] [SCM] bash-completion branch, master, updated. 1bfaacd1a0a79b26b682ed8676341ee88f4ee92d
Guillaume Rousse
guillomovitch at zarb.org
Wed May 20 23:42:44 UTC 2009
The following commit has been merged in the master branch:
commit c1065b3aa972aac09addc718e9a3e5a3f46fc6fa
Author: Guillaume Rousse <guillomovitch at zarb.org>
Date: Thu May 21 01:33:48 2009 +0200
split rsync completion
diff --git a/Makefile.am b/Makefile.am
index 5886034..33b7d02 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -69,6 +69,7 @@ bashcomp_DATA = contrib/ant \
contrib/ri \
contrib/rpcdebug \
contrib/rpmcheck \
+ contrib/rsync \
contrib/samba \
contrib/sbcl \
contrib/screen \
diff --git a/bash_completion b/bash_completion
index 1ebb78d..8e5c1f6 100644
--- a/bash_completion
+++ b/bash_completion
@@ -2856,99 +2856,6 @@ _known_hosts_real()
complete -F _known_hosts traceroute traceroute6 tracepath tracepath6 \
ping ping6 fping fping6 telnet host nslookup rsh rlogin ftp dig ssh-installkeys mtr
-# rsync(1) completion
-#
-have rsync &&
-_rsync()
-{
- local cur prev shell i userhost path
-
- COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
-
- _expand || return 0
-
- case "$prev" in
- --@(config|password-file|include-from|exclude-from))
- _filedir
- return 0
- ;;
- -@(T|-temp-dir|-compare-dest))
- _filedir -d
- return 0
- ;;
- -@(e|-rsh))
- COMPREPLY=( $( compgen -W 'rsh ssh' -- $cur ) )
- return 0
- ;;
- esac
-
- case "$cur" in
- -*)
- COMPREPLY=( $( compgen -W '-v -q -c -a -r -R -b -u -l -L -H \
- -p -o -g -D -t -S -n -W -x -B -e -C -I -T -P \
- -z -h -4 -6 --verbose --quiet --checksum \
- --archive --recursive --relative --backup \
- --backup-dir --suffix= --update --links \
- --copy-links --copy-unsafe-links --safe-links \
- --hard-links --perms --owner --group --devices\
- --times --sparse --dry-run --whole-file \
- --no-whole-file --one-file-system \
- --block-size= --rsh= --rsync-path= \
- --cvs-exclude --existing --ignore-existing \
- --delete --delete-excluded --delete-after \
- --ignore-errors --max-delete= --partial \
- --force --numeric-ids --timeout= \
- --ignore-times --size-only --modify-window= \
- --temp-dir= --compare-dest= --compress \
- --exclude= --exclude-from= --include= \
- --include-from= --version --daemon --no-detach\
- --address= --config= --port= --blocking-io \
- --no-blocking-io --stats --progress \
- --log-format= --password-file= --bwlimit= \
- --write-batch= --read-batch= --help' -- $cur ))
- ;;
- *:*)
- # find which remote shell is used
- shell=ssh
- for (( i=1; i < COMP_CWORD; i++ )); do
- if [[ "${COMP_WORDS[i]}" == -@(e|-rsh) ]]; then
- shell=${COMP_WORDS[i+1]}
- break
- fi
- done
- if [[ "$shell" == ssh ]]; then
- # remove backslash escape from :
- cur=${cur/\\:/:}
- userhost=${cur%%?(\\):*}
- path=${cur#*:}
- # unescape spaces
- path=${path//\\\\\\\\ / }
- if [ -z "$path" ]; then
- # default to home dir of specified
- # user on remote host
- path=$(ssh -o 'Batchmode yes' \
- $userhost pwd 2>/dev/null)
- fi
- # escape spaces; remove executables, aliases, pipes
- # and sockets; add space at end of file names
- COMPREPLY=( $( ssh -o 'Batchmode yes' $userhost \
- command ls -aF1d "$path*" 2>/dev/null | \
- sed -e 's/ /\\\\\\\ /g' -e 's/[*@|=]$//g' \
- -e 's/[^\/]$/& /g' ) )
- fi
- ;;
- *)
- _known_hosts -c -a
- _filedir
- ;;
- esac
-
- return 0
-} &&
-complete -F _rsync $nospace $filenames rsync
-
# Linux route(8) completion
#
[ $UNAME = Linux ] &&
diff --git a/contrib/rsync b/contrib/rsync
new file mode 100644
index 0000000..840a951
--- /dev/null
+++ b/contrib/rsync
@@ -0,0 +1,95 @@
+# -*- mode: shell-script; sh-basic-offset: 8; indent-tabs-mode: t -*-
+# ex: ts=8 sw=8 noet filetype=sh
+#
+# bash completion for rsync
+
+have rsync &&
+_rsync()
+{
+ local cur prev shell i userhost path
+
+ COMPREPLY=()
+ cur=`_get_cword`
+ prev=${COMP_WORDS[COMP_CWORD-1]}
+
+ _expand || return 0
+
+ case "$prev" in
+ --@(config|password-file|include-from|exclude-from))
+ _filedir
+ return 0
+ ;;
+ -@(T|-temp-dir|-compare-dest))
+ _filedir -d
+ return 0
+ ;;
+ -@(e|-rsh))
+ COMPREPLY=( $( compgen -W 'rsh ssh' -- $cur ) )
+ return 0
+ ;;
+ esac
+
+ case "$cur" in
+ -*)
+ COMPREPLY=( $( compgen -W '-v -q -c -a -r -R -b -u -l -L -H \
+ -p -o -g -D -t -S -n -W -x -B -e -C -I -T -P \
+ -z -h -4 -6 --verbose --quiet --checksum \
+ --archive --recursive --relative --backup \
+ --backup-dir --suffix= --update --links \
+ --copy-links --copy-unsafe-links --safe-links \
+ --hard-links --perms --owner --group --devices\
+ --times --sparse --dry-run --whole-file \
+ --no-whole-file --one-file-system \
+ --block-size= --rsh= --rsync-path= \
+ --cvs-exclude --existing --ignore-existing \
+ --delete --delete-excluded --delete-after \
+ --ignore-errors --max-delete= --partial \
+ --force --numeric-ids --timeout= \
+ --ignore-times --size-only --modify-window= \
+ --temp-dir= --compare-dest= --compress \
+ --exclude= --exclude-from= --include= \
+ --include-from= --version --daemon --no-detach\
+ --address= --config= --port= --blocking-io \
+ --no-blocking-io --stats --progress \
+ --log-format= --password-file= --bwlimit= \
+ --write-batch= --read-batch= --help' -- $cur ))
+ ;;
+ *:*)
+ # find which remote shell is used
+ shell=ssh
+ for (( i=1; i < COMP_CWORD; i++ )); do
+ if [[ "${COMP_WORDS[i]}" == -@(e|-rsh) ]]; then
+ shell=${COMP_WORDS[i+1]}
+ break
+ fi
+ done
+ if [[ "$shell" == ssh ]]; then
+ # remove backslash escape from :
+ cur=${cur/\\:/:}
+ userhost=${cur%%?(\\):*}
+ path=${cur#*:}
+ # unescape spaces
+ path=${path//\\\\\\\\ / }
+ if [ -z "$path" ]; then
+ # default to home dir of specified
+ # user on remote host
+ path=$(ssh -o 'Batchmode yes' \
+ $userhost pwd 2>/dev/null)
+ fi
+ # escape spaces; remove executables, aliases, pipes
+ # and sockets; add space at end of file names
+ COMPREPLY=( $( ssh -o 'Batchmode yes' $userhost \
+ command ls -aF1d "$path*" 2>/dev/null | \
+ sed -e 's/ /\\\\\\\ /g' -e 's/[*@|=]$//g' \
+ -e 's/[^\/]$/& /g' ) )
+ fi
+ ;;
+ *)
+ _known_hosts -c -a
+ _filedir
+ ;;
+ esac
+
+ return 0
+} &&
+complete -F _rsync $nospace $filenames rsync
--
bash-completion
More information about the Bash-completion-commits
mailing list