"rsync for cloud storage" - Google Drive, S3, Dropbox, Backblaze B2, One Drive, Swift, Hubic, Wasabi, Google Cloud Storage, Azure Blob, Azure Files, Yandex Files
Go azure-blobazure-blob-storageazure-filesbackblaze-b2cloud-storagedropboxencryptionftpfuse-filesystemgogolanggoogle-cloud-storagegoogle-driveonedriveopenstack-swiftrclones3sftpsyncwebdav
cmd: make autocomplete compatible with bash's posix mode #3489
Danil Semelenov1382dba3c8cf
diff --git a/cmd/help.go b/cmd/help.goindex 3874db1e9..963678ce2 100644--- a/cmd/help.go+++ b/cmd/help.go@@ -39,7 +39,7 @@ documentation, changelog and configuration walkthroughs.const (bashCompletionFunc = `__rclone_custom_func() {- if [[ ${#COMPREPLY[@]} -eq 0 && :$SHELLOPTS: != *:posix:* ]]; then+ if [[ ${#COMPREPLY[@]} -eq 0 ]]; thenlocal cur cword prev wordsif declare -F _init_completion > /dev/null; then_init_completion -n : || return@@ -47,10 +47,14 @@ __rclone_custom_func() {__rclone_init_completion -n : || returnfiif [[ $cur != *:* ]]; then+ local ifs=$IFS+ IFS=$'\n'+ local remotes=($(command rclone listremotes))+ IFS=$ifslocal remote- while IFS= read -r remote; do+ for remote in "${remotes[@]}"; do[[ $remote != $cur* ]] || COMPREPLY+=("$remote")- done < <(command rclone listremotes)+ doneif [[ ${COMPREPLY[@]} ]]; thenlocal paths=("$cur"*)[[ ! -f ${paths[0]} ]] || COMPREPLY+=("${paths[@]}")@@ -62,11 +66,15 @@ __rclone_custom_func() {elselocal prefix=fi+ local ifs=$IFS+ IFS=$'\n'+ local lines=($(rclone lsf "${cur%%:*}:$prefix" 2>/dev/null))+ IFS=$ifslocal line- while IFS= read -r line; do+ for line in "${lines[@]}"; dolocal reply=${prefix:+$prefix/}$line[[ $reply != $path* ]] || COMPREPLY+=("$reply")- done < <(rclone lsf "${cur%%:*}:$prefix" 2>/dev/null)+ done[[ ! ${COMPREPLY[@]} || $(type -t compopt) != builtin ]] || compopt -o filenamesfi[[ ! ${COMPREPLY[@]} || $(type -t compopt) != builtin ]] || compopt -o nospace