forked from ultraworkers/claw-code
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·64 lines (55 loc) · 1.19 KB
/
Copy pathinstall.sh
File metadata and controls
executable file
·64 lines (55 loc) · 1.19 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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#!/usr/bin/env sh
set -eu
usage() {
cat <<'EOF'
Usage: ./install.sh [--system] [--cargo-bin] [--bin-dir <dir>]
Builds the release `claw` binary and installs it into one of:
~/.cargo/bin (default)
/usr/local/bin (with --system)
<dir> (with --bin-dir)
EOF
}
SCRIPT_DIR=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd)
BIN_DIR=${CLAW_INSTALL_DIR:-}
while [ "$#" -gt 0 ]; do
case "$1" in
--system)
BIN_DIR=/usr/local/bin
shift
;;
--cargo-bin)
BIN_DIR=${HOME}/.cargo/bin
shift
;;
--bin-dir)
if [ "$#" -lt 2 ]; then
usage >&2
exit 1
fi
BIN_DIR=$2
shift 2
;;
-h|--help)
usage
exit 0
;;
*)
usage >&2
exit 1
;;
esac
done
if [ -z "$BIN_DIR" ]; then
BIN_DIR=${HOME}/.cargo/bin
fi
mkdir -p "$BIN_DIR"
cargo build --release --manifest-path "$SCRIPT_DIR/rust/Cargo.toml" -p rusty-claude-cli
install -m 755 "$SCRIPT_DIR/rust/target/release/claw" "$BIN_DIR/claw"
printf 'Installed claw to %s\n' "$BIN_DIR/claw"
case ":${PATH:-}:" in
*":$BIN_DIR:"*)
;;
*)
printf 'warning: add %s to PATH if `claw` is not yet discoverable\n' "$BIN_DIR" >&2
;;
esac