-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathsetup.sh
More file actions
executable file
·35 lines (27 loc) · 811 Bytes
/
setup.sh
File metadata and controls
executable file
·35 lines (27 loc) · 811 Bytes
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
#!/bin/bash
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
usage() {
echo "Use: source setup.sh --target <local|docker> [--shell <bash|zsh>] [--sync]"
return 1 2>/dev/null || exit 1
}
TARGET=""
SYNC="false"
SHELL_TYPE="bash" # default
while [[ $# -gt 0 ]]; do
case "$1" in
--target) TARGET="$2"; shift 2 ;;
--shell) SHELL_TYPE="$2"; shift 2 ;;
--sync) SYNC="true"; shift ;;
*) usage; return 1 2>/dev/null || exit 1 ;;
esac
done
if [ -z "$TARGET" ]; then
usage
return 1 2>/dev/null || exit 1
fi
TARGET_SCRIPT="$SCRIPT_DIR/scripts/targets/$TARGET.sh"
if [ ! -f "$TARGET_SCRIPT" ]; then
echo "[error] Target '$TARGET' doesn't exist. Options: local, docker"
return 1 2>/dev/null || exit 1
fi
source "$TARGET_SCRIPT" "$SCRIPT_DIR" "$SYNC" "$SHELL_TYPE"