#!/bin/sh # Claude Code status line — mirrors the zsh prompt from ~/.zshrc # PROMPT: [%D %*] $WHO $HOST:${PWD/#$HOME/~} %(?..[%?] )$NEWLINE%# # RPROMPT: ${vcs_info_msg_0_} (format: "on %b") # # Wired via the statusLine entry in .claude/settings.json; make install # symlinks this file to ~/.claude/statusline-command.sh on every machine. input=$(cat) cwd=$(echo "$input" | jq -r '.cwd') # Replace $HOME prefix with ~. The replacement tilde must be escaped: # unquoted, bash tilde-expands it straight back to $HOME. home="$HOME" display_dir="${cwd/#$home/\~}" # Git branch from cwd (mirrors vcs_info RPROMPT "on %b") branch=$(git -C "$cwd" symbolic-ref --short HEAD 2>/dev/null) git_part="" [ -n "$branch" ] && git_part=" on $branch" date_part=$(date "+%y-%m-%d %H:%M:%S") user_part=$(whoami) # uname -n, not hostname: Arch doesn't ship hostname by default (inetutils). host_part=$(uname -n) printf "%s %s %s:%s%s" "[$date_part]" "$user_part" "$host_part" "$display_dir" "$git_part"