aboutsummaryrefslogtreecommitdiffhomepage
path: root/share/completions/rsync.fish
diff options
context:
space:
mode:
authorGravatar David Adam (zanchey) <zanchey@ucc.gu.uwa.edu.au>2013-06-03 19:59:09 +0800
committerGravatar David Adam (zanchey) <zanchey@ucc.gu.uwa.edu.au>2013-06-03 20:04:32 +0800
commitb4d33a58b142adae99a6a7547cd9cf31cfbe68e5 (patch)
tree7120fc8b023629d9cbfdaa2e87ad1f141bf26856 /share/completions/rsync.fish
parentc177965da5d4fbf3aed0d3e4f227572394b8d1bf (diff)
rsync completions: use rsync --list-only to generate completions, allowing the use of rsync daemons
Diffstat (limited to 'share/completions/rsync.fish')
-rw-r--r--share/completions/rsync.fish12
1 files changed, 5 insertions, 7 deletions
diff --git a/share/completions/rsync.fish b/share/completions/rsync.fish
index 7ed1be82..5a758175 100644
--- a/share/completions/rsync.fish
+++ b/share/completions/rsync.fish
@@ -107,14 +107,12 @@ complete -c rsync -l help --description "Display help and exit"
#
# Remote path
#
-complete -c rsync -d "Remote Path" -n "commandline -ct|sgrep -o '.*:'" -a "
-
+complete -c rsync -d "Remote path" -n "commandline -ct|sgrep -q :" -a "
(
- #Prepend any user@host information supplied before the remote completion
- commandline -ct|sgrep -o '.*:'
+ #Prepend any user@host:/path information supplied before the remote completion
+ commandline -ct|sgrep -Eo '.*:+(.*/)?'
)(
- #Get the list of remote files from the specified ssh server
- ssh -o \"BatchMode yes\" (commandline -ct|sed -ne 's/\(.*\):.*/\1/p') ls\ -dp\ (commandline -ct|sed -ne 's/.*://p')\* 2> /dev/null
+ #Get the list of remote files from the specified rsync server
+ rsync --list-only (commandline -ct|sgrep -Eo '.*:+(.*/)?') ^/dev/null | awk '{if (\$1 ~ \"^d\" ) {print \$NF \"/\";} else {print \$NF;} };'
)
-
"