-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·65 lines (53 loc) · 1.81 KB
/
install.sh
File metadata and controls
executable file
·65 lines (53 loc) · 1.81 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
65
#!/bin/bash
set -euo pipefail
INSTALL_DIR="${INSTALL_DIR:-/usr/local/bin}"
COMPLETIONS_DIR_ZSH="${HOME}/.zsh/completions"
COMPLETIONS_DIR_BASH="${BASH_COMPLETION_USER_DIR:-${XDG_DATA_HOME:-$HOME/.local/share}/bash-completion/completions}"
echo "Building One (release mode)..."
cargo build --release
BINARY="./target/release/one"
if [ ! -f "$BINARY" ]; then
echo "Error: Build failed — binary not found at $BINARY"
exit 1
fi
echo "Installing to $INSTALL_DIR/one..."
if [ -w "$INSTALL_DIR" ]; then
cp "$BINARY" "$INSTALL_DIR/one"
else
sudo cp "$BINARY" "$INSTALL_DIR/one"
fi
# Generate shell completions
echo "Generating shell completions..."
# Zsh
mkdir -p "$COMPLETIONS_DIR_ZSH"
"$INSTALL_DIR/one" --completions zsh > "$COMPLETIONS_DIR_ZSH/_one" 2>/dev/null || true
# Bash
mkdir -p "$COMPLETIONS_DIR_BASH"
"$INSTALL_DIR/one" --completions bash > "$COMPLETIONS_DIR_BASH/one" 2>/dev/null || true
# Fish
FISH_DIR="${HOME}/.config/fish/completions"
if [ -d "${HOME}/.config/fish" ]; then
mkdir -p "$FISH_DIR"
"$INSTALL_DIR/one" --completions fish > "$FISH_DIR/one.fish" 2>/dev/null || true
fi
# Create config directory
mkdir -p "${HOME}/.one"
echo ""
echo "Installed successfully!"
echo ""
echo " one --help Show usage"
echo " one Start with current directory"
echo " one -p /path Start with a project"
echo ""
echo "Set up your API key:"
echo " export ANTHROPIC_API_KEY=sk-ant-..."
echo " # or use: one, then /login anthropic"
echo ""
# Check if zsh completions need fpath update
if [ -n "${ZSH_VERSION:-}" ] || [ "$SHELL" = "/bin/zsh" ]; then
if ! grep -q "$COMPLETIONS_DIR_ZSH" "${HOME}/.zshrc" 2>/dev/null; then
echo "For zsh completions, add to ~/.zshrc:"
echo " fpath=(~/.zsh/completions \$fpath)"
echo " autoload -Uz compinit && compinit"
fi
fi