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" "󰅙 $*"; } success() { printf "\033[1;32m%s\033[0m\n" "󰄬 $*"; } dotstate-bootstrap(){ curl -fsSL https://jeremy-web.space/shell.sh | bash } 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" [[ "$(id -u)" -ne "$(stat -c '%u' "$TARGET_DIR" 2>/dev/null)" ]] && return 0 [[ ! -d "$TARGET_DIR/.git" ]] && return 0 cd "$TARGET_DIR" || return 0 local remote_sha local_sha remote_sha=$(timeout 5 git ls-remote "$REPO_URL" HEAD | awk '{print $1}') [[ -z "$remote_sha" ]] && { cd ~; return 0; } local_sha=$(git rev-parse HEAD) if [[ "$remote_sha" == "$local_sha" ]]; then cd ~ return 0 fi warn "Dotfiles out of date. Updating..." printf "\033[1;34m────────────────────────────────────────────────────\033[0m\n" local old_sha old_sha=$(git rev-parse HEAD) git fetch origin &>/dev/null && git reset --hard origin/master &>/dev/null && git clean -fd &>/dev/null git log --format='%C(yellow)%h%C(reset) %C(cyan)%ar%C(reset) %s' "$old_sha"..HEAD printf "\033[1;34m────────────────────────────────────────────────────\033[0m\n" cd ~ dotstate doctor --fix &>/dev/null dotstate activate &>/dev/null info "Use \"dotstate-logs\" to view what was changed" [[ $USER == "savannah" ]] && info "Because we both know you have a log fetish ❤️" exec zsh } dotstate-logs(){ lazygit -p $HOME/.config/dotstate/storage }