Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,10 @@ bun link # optional global arrowcode / ac

### Update

To update ArrowCode while preserving any local modifications you have made:
To instantly update ArrowCode from any directory, keeping your local changes preserved:

```bash
./update.sh
curl -fsSL https://raw.githubusercontent.com/Chintanpatel24/arrowcode/main/update.sh | bash
```

### Setup API key
Expand Down
26 changes: 24 additions & 2 deletions update.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,30 @@ log() { printf '%s==>%s %s\n' "$CYN" "$RST" "$*"; }
ok() { printf '%s[ok]%s %s\n' "$GRN" "$RST" "$*"; }
err() { printf '%s[err]%s %s\n' "$RED" "$RST" "$*" >&2; }

# Find ArrowCode base directory
DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
# Find ArrowCode base directory dynamically (even if piped via stdin)
if [ -n "${BASH_SOURCE[0]:-}" ] && [ -f "${BASH_SOURCE[0]}" ]; then
DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
else
# fallback to global/local shared locations if piped via stdin
DIR="${ARROWCODE_DIR:-$HOME/.local/share/arrowcode}"
fi

if [ ! -d "$DIR" ] || [ ! -f "$DIR/package.json" ]; then
# Try to find base from command line 'arrowcode' binary symlink or standard home folder
if command -v arrowcode >/dev/null 2>&1; then
BIN_PATH=$(which arrowcode)
if [ -h "$BIN_PATH" ]; then
REAL_BIN=$(readlink "$BIN_PATH")
DIR="$(cd "$(dirname "$REAL_BIN")/.." && pwd)"
fi
fi
fi

if [ ! -d "$DIR" ] || [ ! -f "$DIR/package.json" ]; then
err "Could not find ArrowCode installation directory. Please run the installer first or set ARROWCODE_DIR."
exit 1
fi

cd "$DIR"

log "Updating ArrowCode at $DIR..."
Expand Down
Loading