commit 28e43d1114dd2497b0b4e29ae68cb5351e08ad8c parent db6696ffea1d622e74aa76ef8a792a1689959a14 Author: William Casarin <jb55@jb55.com> Date: Tue, 4 Jan 2022 11:00:01 -0800 add git stuff to general-status Diffstat:
M | bin/general-status | | | 20 | +++++++++++++++++--- |
1 file changed, 17 insertions(+), 3 deletions(-)
diff --git a/bin/general-status b/bin/general-status @@ -1,11 +1,25 @@ #!/usr/bin/env bash +set eou -pipefail + #export LESS="-R -S --quit-if-one-screen" -printf "%s@%s:%s\n" \ - "$USER" \ +git_status () { + if gres=$(git symbolic-ref --short HEAD 2>/dev/null); then + printf "[$gres]\n" + fi +} + +USR="" +if [ "$USER" != "jb55" ]; then + USR="$USER " +fi + +printf "%s%s %s %s\n" \ + "$USR" \ "$HOSTNAME" \ - "$PWD" + "$PWD" \ + "$(git_status)" #if git rev-parse --is-inside-work-tree >/dev/null 2>/dev/null; then # printf "\n"