general-status (1247B)
1 #!/usr/bin/env bash 2 3 set eou -pipefail 4 5 #export LESS="-R -S --quit-if-one-screen" 6 7 git_status () { 8 if gres=$(git symbolic-ref --short HEAD 2>/dev/null); then 9 printf "[$gres]\n" 10 fi 11 } 12 13 mail_status() { 14 queued=$(msmtp-queue 2>&1| grep '^\s*mail' | wc -l) 15 if [[ $queued -gt 0 ]] 16 then 17 echo "${queued}x📤" 18 fi 19 } 20 21 USR="" 22 if [ "$USER" != "jb55" ]; then 23 USR="$USER " 24 fi 25 26 printf "%s%s %s %s\n" \ 27 "$USR" \ 28 "$PWD" \ 29 "$(git_status)" \ 30 "$(mail_status)" 31 32 #if git rev-parse --is-inside-work-tree >/dev/null 2>/dev/null; then 33 # printf "\n" 34 # conf="-c color.status=always -c color.branch=always" 35 # eachreffmt='%(authordate:short) %(authorname) %(color:red)%(objectname:short) %(color:yellow)%(refname:short)%(color:reset) (%(color:green)%(committerdate:relative)%(color:reset))' 36 # git $conf status -s 37 # git $conf remote -v | grep \(fetch\) | column -t -s $'\t' "$@" 38 # brconf="--sort=-committerdate" 39 # COLUMNS=$(stty size | cut -d" " -f2) 40 # 41 # timeout 1 git lg --color=always --simplify-by-decoration || ( 42 # printf "\n" 43 # git for-each-ref --color=always --sort=-committerdate refs/heads/ --format="$eachreffmt" 44 # printf "\n" 45 # git for-each-ref --color=always --sort=-committerdate refs/remotes/ --format="$eachreffmt" 46 # ) 47 # 48 #fi) | less -RSF