32 lines
1.0 KiB
Bash
32 lines
1.0 KiB
Bash
info() { printf "\033[1;34m%s\033[0m\n" "$*"; }
|
|
warn() { printf "\033[1;33m%s\033[0m\n" "$*"; }
|
|
error() { printf "\033[1;31m%s\033[0m\n" "$*"; }
|
|
|
|
|
|
fix_btopbg(){
|
|
sed -i 's/theme_background = true/theme_background = false/' ~/.config/btop/btop.conf
|
|
}
|
|
|
|
install_opencode(){
|
|
curl -fsSL https://opencode.ai/install | bash
|
|
}
|
|
|
|
dotstate_update() {
|
|
local REPO_URL="https://git.jeremymcclure.com/jeremy/dotstate-storage.git"
|
|
local TARGET_DIR="$HOME/.config/dotstate/storage"
|
|
|
|
if [[ -d "$TARGET_DIR/.git" ]]; then
|
|
local remote_sha local_sha
|
|
remote_sha=$(timeout 5 git ls-remote "$REPO_URL" HEAD | awk '{print $1}')
|
|
[[ -z "$remote_sha" ]] && return 0
|
|
local_sha=$(git -C "$TARGET_DIR" rev-parse HEAD)
|
|
[[ "$remote_sha" == "$local_sha" ]] && return 0
|
|
info "Repository out of date. Pulling updates..."
|
|
git -C "$TARGET_DIR" pull &>/dev/null
|
|
else
|
|
info "Repository not found. Cloning..."
|
|
git clone --depth=1 "$REPO_URL" "$TARGET_DIR" &>/dev/null
|
|
fi
|
|
dotstate activate
|
|
exec zsh
|
|
} |