-
Notifications
You must be signed in to change notification settings - Fork 13
Expand file tree
/
Copy pathvidedev
More file actions
executable file
·46 lines (40 loc) · 1.18 KB
/
videdev
File metadata and controls
executable file
·46 lines (40 loc) · 1.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#!/bin/bash
# videdev - Development version of vide
# Runs the local bin/vide.dart
# Use -d to enable VM services for debugging
# Resolve symlinks to get the real script location
SOURCE="${BASH_SOURCE[0]}"
while [ -L "$SOURCE" ]; do
DIR="$(cd -P "$(dirname "$SOURCE")" && pwd)"
SOURCE="$(readlink "$SOURCE")"
[[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE"
done
SCRIPT_DIR="$(cd -P "$(dirname "$SOURCE")" && pwd)"
# Parse arguments
DART_ARGS=()
VIDE_ARGS=()
ENABLE_VM_SERVICE=false
WORKTREE_NUM=""
for arg in "$@"; do
if [[ "$arg" == "-d" ]]; then
ENABLE_VM_SERVICE=true
elif [[ "$arg" =~ ^--([0-9]+)$ ]]; then
WORKTREE_NUM="${BASH_REMATCH[1]}"
else
VIDE_ARGS+=("$arg")
fi
done
if [[ "$ENABLE_VM_SERVICE" == true ]]; then
DART_ARGS+=("--enable-vm-service")
fi
# Use worktree directory if --<number> was specified
if [[ -n "$WORKTREE_NUM" ]]; then
RUN_DIR="/Users/norbertkozsir/IdeaProjects/vide_cli_$WORKTREE_NUM"
if [[ ! -d "$RUN_DIR" ]]; then
echo "Error: Directory $RUN_DIR does not exist" >&2
exit 1
fi
else
RUN_DIR="$SCRIPT_DIR"
fi
exec dart "${DART_ARGS[@]}" --packages="$RUN_DIR/.dart_tool/package_config.json" "$RUN_DIR/bin/vide.dart" "${VIDE_ARGS[@]}"