2022-02-03

This commit is contained in:
Louis Seubert 2022-02-03 19:33:04 +01:00
parent f86b8496ec
commit db393215ce
Signed by: louis9902
GPG key ID: 4B9DB28F826553BD
55 changed files with 1907 additions and 0 deletions

View file

@ -0,0 +1 @@
basename "${VIRTUAL_ENV:-}" 2>/dev/null

View file

@ -0,0 +1,40 @@
#!/bin/bash
{ type -p git && git rev-parse --git-dir; } >/dev/null 2>&1 || exit $?
# see https://git-scm.com/docs/git-status for more information
# these are status information from the local git index
CAH=0 CBH=0
D=0 A=0 M=0 R=0 U=0 I=0
while read -r format state values; do
case ${format} in
\#)
case ${state} in
branch.oid) COMMIT="${values}" ;;
branch.head) BRANCH="${values}" ;;
branch.upstream) UPSTREAM="${values}" ;;
branch.ab) read -r CAH CBD <<<"${values}" ;;
esac
;;
1) (( ${state:0:1}++ )) ;;
2) (( ${state:0:1}++ )) ;;
\?) (( U++ )) ;;
\!) (( I++ )) ;;
esac
done < <(git status --porcelain=2 --branch)
[[ ${CAH} -gt 0 ]] && echo -n "\\[\\e[0;32m\\]<\\[\\e[0m\\]${CAH} ";
[[ ${CBH} -gt 0 ]] && echo -n "\\[\\e[0;31m\\]>\\[\\e[0m\\]${CBH} ";
[[ ${M} -gt 0 ]] && _BRANCH="\\[\\e[0;31m\\]" || _BRANCH="\\[\\e[0;32m\\]"
if [[ "${BRANCH}" == "(detached)" ]]; then
BRANCH="{${COMMIT:0:8}}"
else
BRANCH="(${BRANCH})"
fi
echo -n "${_BRANCH}${BRANCH}\\[\\e[0m\\] "
[[ ${A} -gt 0 ]] && echo -n "\\[\\e[0;32m\\]+\\[\\e[0m\\]${A} ";
[[ ${D} -gt 0 ]] && echo -n "\\[\\e[0;31m\\]-\\[\\e[0m\\]${D} ";
[[ ${M} -gt 0 ]] && echo -n "\\[\\e[0;35m\\]~\\[\\e[0m\\]${M} ";
[[ ${U} -gt 0 ]] && echo -n "\\[\\e[0;33m\\]?\\[\\e[0m\\]${U} ";