bin/git_prompt_status @ 5d1659688c9b

More
author Steve Losh <steve@stevelosh.com>
date Mon, 26 Nov 2018 10:31:19 -0500
parents 1a4e4c34085d
children (none)
#!/usr/bin/env bash

INDEX=$(git status --porcelain 2> /dev/null)
STATUS=""


if $(echo "$INDEX" | grep '^UU ' &> /dev/null); then
    STATUS="C$STATUS"
fi

if $(echo "$INDEX" | grep '^.[MD] ' &> /dev/null); then
    STATUS="?$STATUS"
elif $(echo "$INDEX" | grep '^?? ' &> /dev/null); then
    STATUS="?$STATUS"
fi

if $(echo "$INDEX" | grep '^[AMDR]. ' &> /dev/null); then
    STATUS="!$STATUS"
fi

echo -n $STATUS