Revision 9889
Added by Aaron Marcuse-Kubitza over 11 years ago
lib/sh/sync.sh | ||
---|---|---|
5 | 5 |
|
6 | 6 |
alias use_sync='declare prefix=sync_; import_vars; unset prefix' |
7 | 7 |
|
8 |
upload() # usage: local_dir=... remote_url=server:dir upload paths...
|
|
8 |
upload() # usage: local_dir=... remote_url=server:dir upload [opt|path]...
|
|
9 | 9 |
# requires put from https://uutils.googlecode.com/svn/trunk/bin/put |
10 | 10 |
{ |
11 | 11 |
echo_func; kw_params local_dir remote_url swap |
12 | 12 |
|
13 |
base_dir="$local_dir" cmd=canon_rel_path foreach_arg |
|
14 |
# also need to --include parent dirs for each --include path |
|
13 |
# change path args to --includes |
|
15 | 14 |
local args=() |
16 |
local a; for a in "$@"; do path_parents "$a"; args+=("${dirs[@]}"); done |
|
15 |
local a; for a in "$@"; do |
|
16 |
if starts_with -- "$a"; then args+=("$a") # option, so leave as is |
|
17 |
else # path |
|
18 |
# also need to --include parent dirs for each --include path |
|
19 |
path_parents "$(base_dir="$local_dir" canon_rel_path "$a")" |
|
20 |
args+=("${dirs[@]/#/--include=/}") # prepend each with --include=/ |
|
21 |
fi |
|
22 |
done |
|
17 | 23 |
set -- "${args[@]}" |
18 | 24 |
|
19 |
set -- "${@/#/--include=/}" # prepend each with --include=/ |
|
20 | 25 |
src="$local_dir" dest="$remote_url" command put "$@" --exclude="**" |
21 | 26 |
} |
22 | 27 |
|
Also available in: Unified diff
lib/sh/sync.sh: upload(): support passing -- options to put, which will not be run through the path->--include processing