Created
April 23, 2014 15:42
-
-
Save morganestes/11220516 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # | |
| # Get a list of props from the log and search for a given name. | |
| # | |
| # Example: add `getprops <name>` to the end of this file and run | |
| # `$ ./propslog.sh` from the command line. | |
| # | |
| # You can also add this to your ~/.functions file and use | |
| # `getprops <name>` inside your local WordPress Core repo. | |
| # | |
| function getprops() { | |
| if [ -n "$1" ] | |
| then | |
| local name="$1" | |
| else | |
| local name="blamenacin" #default if nothing passed | |
| fi | |
| # build the propslog file | |
| git log -i --grep props | egrep -io 'props (to )?[a-z0-9_\-]*' | sed 's/.* //' | sort | uniq -c | sort -k1nr > propslog.txt | |
| local rank=`grep -inr ${name} propslog.txt | awk '{print $2}' FS=":"` | |
| local total=`wc -l < propslog.txt | tr -d ' '` | |
| # where is our contributor? | |
| grep -i "$name" propslog.txt | |
| echo "$name is $rank of $total named contributors." | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # git pull | |
| git log -i --grep props | egrep -io 'props (to )?[a-z0-9_\-]*' | sed 's/.* //' | sort | uniq -c | sort -k1nr > propslog.txt | |
| grep -i morganestes propslog.txt | |
| echo 'Ranked' $(awk '/morganestes/ {print FNR}' propslog.txt) 'of' $(wc -l < propslog.txt) 'total contributors.' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment