From 315d2984054493ebbcee1c3e7f712dc60bdf2e62 Mon Sep 17 00:00:00 2001 From: Hunter Kvalevog Date: Mon, 13 Jul 2026 19:18:45 -0500 Subject: --- .bashrc | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100755 .bashrc diff --git a/.bashrc b/.bashrc new file mode 100755 index 0000000..7b7478f --- /dev/null +++ b/.bashrc @@ -0,0 +1,30 @@ +#!/bin/sh + +# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +# Prompt +# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +git_branch() { + local branch + branch=$(git symbolic-ref --short HEAD 2>/dev/null) || return + local dirty="" + [ -n "$(git status --porcelain 2>/dev/null)" ] && dirty="*" + echo " (${branch}${dirty})" +} + +# Colors +RESET='\[\e[0m\]' +BOLD='\[\e[1m\]' +GREEN='\[\e[32m\]' +BLUE='\[\e[34m\]' +YELLOW='\[\e[33m\]' +RED='\[\e[31m\]' + +# Exit-status-aware prompt (shows red if last command failed) +set_prompt() { + local exit_code=$? + local status_color="${GREEN}" + [ $exit_code -ne 0 ] && status_color="${RED}" + + PS1="${status_color}\u${RESET}@${GREEN}\h${RESET}:${YELLOW}\w${RESET}\$(git_branch)${BOLD} \$ ${RESET}" +} +PROMPT_COMMAND="set_prompt; ${PROMPT_COMMAND}" -- cgit v1.2.3