File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -83,6 +83,14 @@ bun install
8383bun link # optional global arrowcode / ac
8484```
8585
86+ ### Update
87+
88+ To update ArrowCode while preserving any local modifications you have made:
89+
90+ ``` bash
91+ ./update.sh
92+ ```
93+
8694### Setup API key
8795
8896``` bash
Original file line number Diff line number Diff line change 1+ #! /usr/bin/env bash
2+ set -euo pipefail
3+
4+ # ArrowCode local updater script
5+ # Updates the ArrowCode repository to the latest code on the current branch while preserving local changes
6+
7+ RED=$' \033 [0;31m'
8+ GRN=$' \033 [0;32m'
9+ CYN=$' \033 [0;36m'
10+ RST=$' \033 [0m'
11+
12+ log () { printf ' %s==>%s %s\n' " $CYN " " $RST " " $* " ; }
13+ ok () { printf ' %s[ok]%s %s\n' " $GRN " " $RST " " $* " ; }
14+ err () { printf ' %s[err]%s %s\n' " $RED " " $RST " " $* " >&2 ; }
15+
16+ # Find ArrowCode base directory
17+ DIR=" $( cd " $( dirname " ${BASH_SOURCE[0]} " ) " && pwd) "
18+ cd " $DIR "
19+
20+ log " Updating ArrowCode at $DIR ..."
21+
22+ # Keep local changes with git stash if there are any
23+ HAS_CHANGES=0
24+ if ! git diff --quiet || ! git diff --cached --quiet; then
25+ HAS_CHANGES=1
26+ log " Saving local changes with git stash..."
27+ git stash -u
28+ fi
29+
30+ # Fetch and rebase / merge latest from branch
31+ BRANCH=$( git rev-parse --abbrev-ref HEAD)
32+ log " Fetching latest commits from remote on branch: $BRANCH "
33+ git fetch origin " $BRANCH "
34+
35+ log " Pulling latest changes..."
36+ git pull --rebase origin " $BRANCH "
37+
38+ # Restore local changes if stashed
39+ if [ " $HAS_CHANGES " -eq 1 ]; then
40+ log " Restoring local changes..."
41+ git stash pop
42+ fi
43+
44+ # Re-install dependencies with bun
45+ log " Running bun install to ensure package sync..."
46+ bun install
47+
48+ ok " ArrowCode successfully updated!"
You can’t perform that action at this time.
0 commit comments