Project

General

Profile

1
#!/bin/bash -e
2
. "$(dirname "${BASH_SOURCE[0]}")"/util.sh
3

    
4
if self_not_included; then
5

    
6
alias use_sync='declare prefix=sync_; import_vars; unset prefix'
7

    
8
upload() # usage: local_dir=... remote_url=server:dir upload [opt|path]...
9
# requires put from https://uutils.googlecode.com/svn/trunk/bin/put
10
{
11
	echo_func; kw_params local_dir remote_url; echo_vars swap
12
	
13
	# change path args to --includes
14
	local has_includes= args=()
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
			has_includes=1
22
		fi
23
	done
24
	set -- "${args[@]}" ${has_includes:+--exclude="**"}
25
	
26
	src="$local_dir" dest="$remote_url" command put "$@"
27
}
28

    
29
fi
(8-8/10)