#!/bin/bash
source ~/.bashrc
shopt -s expand_aliases
aliases=$(alias | awk -F'[= ]' '{print $2}' | grep "^cdw80" | sort)
echo 'PORT BRANCH COMMITTER'
for i in $aliases;
do
    port=${i#cdw}
    #temporarily hide
    if [ "$port" -eq "8099" ];then
        continue
    fi
    eval $i
    #branch=$(git branch | grep \* | awk '{print $NF}')
    #branch=$(git rev-parse --abbrev-ref HEAD)
    branch=$(git symbolic-ref --short HEAD)
    if [ $branch == 'develop' ];then
        committer=''
    else
        committer=$(git log -1 --pretty=format:"%cn")
        committer=${committer%%@*}
    fi
    echo "$port $branch $committer"
done