diff --git a/curl/upload/file/posix.tmpl.sh b/curl/upload/file/posix.tmpl.sh index 0878ef9b2a2c771e9b96a7453d3ffe78ca339aa3..59ee3425a50f4c72d0209564b80868afc5613283 100644 --- a/curl/upload/file/posix.tmpl.sh +++ b/curl/upload/file/posix.tmpl.sh @@ -34,6 +34,7 @@ fi # Parse arguments ENDPOINT="${URL}" +DIRECTORY="/" DESTINATION="${DST}" while test 0 -ne "${#}"; do case "${1}" in @@ -41,7 +42,11 @@ while test 0 -ne "${#}"; do shift ENDPOINT="${1?Must provide an argument for --url}" ;; - "--destination") + "--dir" | "--directory") + shift + DIRECTORY="${DIRECTORY}${1?Must provide an argument for --directory}/" + ;; + "--dst" | "--destination") shift DESTINATION="${1?Must provide an argument for --destination}" ;; @@ -52,9 +57,12 @@ while test 0 -ne "${#}"; do esac shift done -readonly ENDPOINT DESTINATION +readonly ENDPOINT DIRECTORY DESTINATION + +COMPOSED="${ENDPOINT}${DIRECTORY}${DESTINATION}" +readonly COMPOSED -printf >&2 "Uploading: %s to %s\n" "${SRC}" "${ENDPOINT}/${DESTINATION}" +printf >&2 "Uploading: %s to %s\n" "${SRC}" "${COMPOSED}" # Do the upload "${RUNFILES}/${CURL}" \ @@ -64,4 +72,4 @@ printf >&2 "Uploading: %s to %s\n" "${SRC}" "${ENDPOINT}/${DESTINATION}" --retry "${RETRY}" \ --retry-delay "${RETRY_DELAY}" \ --upload-file "${RUNFILES}/${SRC}" \ - "${ENDPOINT}/${DESTINATION}" + "${COMPOSED}"