bin/git_prompt_status @ 3d37ca22c5c5
bpollack/use-command-to-explicitly-call-ag-and-us-1442506830050
Use command to explicitly call ag, and use compound if block
author |
Benjamin Pollack <benjamin@bitquabit.com> |
date |
Thu, 17 Sep 2015 16:20:42 +0000 |
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