Skip to content

Instantly share code, notes, and snippets.

@apolzon
Created September 20, 2013 17:04
Show Gist options
  • Save apolzon/6640617 to your computer and use it in GitHub Desktop.
Save apolzon/6640617 to your computer and use it in GitHub Desktop.
Quick status for OKL
#!/bin/zsh
cd ~/dev/okl
pwd
for i in * ; do
( cd $i
if [ "$i" = "hunters-alley-chef" ] || [ "$i" = "hunters-alley-dev" ] || [ "$i" = "hunters-alley-ios" ] || [ "$i" = "hunters-alley-docs" ] ; then
continue
fi
dirname=$i
RES=$(git status | grep -E '^# (Changes|Changed|Untracked)')
BRANCH=$(git branch | sed -n '/\* /s///p')
MASTER="master"
STAT=""
grep -e 'Changed' <<<${RES} >/dev/null 2>&1
if [ $? -eq 0 ] ; then
STAT="$STAT \e[01;34m[Modified]\e[0m"
fi
grep -e 'Changes' <<<${RES} >/dev/null 2>&1
if [ $? -eq 0 ] ; then
i="\e[01;35m$dirname\e[0m"
STAT="$STAT [Staged]"
fi
grep -e 'Untracked' <<<${RES} >/dev/null 2>&1
if [ $? -eq 0 ] ; then
i="\e[01;31m$dirname\e[0m"
STAT="[Untracked]"
fi
if [ "$i" = "$dirname" ] ; then
i="\e[01;32m$dirname\e[0m"
fi
echo "$i : $STAT on $BRANCH"
)
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment