39 lines
778 B
Bash
Executable file
39 lines
778 B
Bash
Executable file
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
|
|
STATIC=""
|
|
OUTFILE=""
|
|
ARGS=()
|
|
|
|
while [ $# -gt 0 ]; do
|
|
case "$1" in
|
|
--static)
|
|
STATIC="--static"
|
|
shift
|
|
;;
|
|
--out)
|
|
if [ $# -lt 2 ]; then
|
|
echo "Error: --out requires a file path" >&2
|
|
exit 1
|
|
fi
|
|
OUTFILE="$2"
|
|
shift 2
|
|
;;
|
|
*)
|
|
ARGS+=("$1")
|
|
shift
|
|
;;
|
|
esac
|
|
done
|
|
|
|
if [ ${#ARGS[@]} -lt 3 ]; then
|
|
echo "Usage: difftool.sh [--static] [--out <file>] <git-project-dir> <main branch> <feature branch> [port]" >&2
|
|
exit 1
|
|
fi
|
|
|
|
script_dir="$(cd "$(dirname "$0")" && pwd)"
|
|
node_args=("$script_dir/dist/server.cjs")
|
|
[ -n "$STATIC" ] && node_args+=("$STATIC")
|
|
[ -n "$OUTFILE" ] && node_args+=("--out" "$OUTFILE")
|
|
node_args+=("${ARGS[@]}")
|
|
exec node "${node_args[@]}"
|