rsync input handling improv
This commit is contained in:
+23
-8
@@ -25,15 +25,30 @@ source "$SCRIPT_DIR/../common.sh"
|
|||||||
|
|
||||||
parse_args "$@"
|
parse_args "$@"
|
||||||
|
|
||||||
# ----------------------------- INPUT -----------------------------
|
# ----------------------------
|
||||||
if [[ -z "$DIRECTORY" ]]; then
|
# INPUT HANDLING (FIXED)
|
||||||
if [[ "${1:-}" != "" && "${1:-}" != --* && "${1:-}" != *=* ]]; then
|
# ----------------------------
|
||||||
DIRECTORY="$1"
|
|
||||||
shift
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
[[ -z "$DIRECTORY" ]] && error "Missing directory" && exit 1
|
DIRECTORY=""
|
||||||
|
|
||||||
|
for ARG in "$@"; do
|
||||||
|
case "$ARG" in
|
||||||
|
--*|*=*)
|
||||||
|
# skip flags and key=value
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
if [[ -z "$DIRECTORY" ]]; then
|
||||||
|
DIRECTORY="$ARG"
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
if [[ -z "$DIRECTORY" ]]; then
|
||||||
|
error "Missing directory"
|
||||||
|
echo "Usage: $0 <directory> [--dry-run] [--status] [VAR=value]"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
# ----------------------------- HOST -----------------------------
|
# ----------------------------- HOST -----------------------------
|
||||||
detect_hosts
|
detect_hosts
|
||||||
|
|||||||
Reference in New Issue
Block a user