Last active
August 29, 2015 14:13
-
-
Save doctorallen/675984b66c52412f23ed to your computer and use it in GitHub Desktop.
Run A Time Report
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
#!/usr/bin/env bash | |
# You will want to also add the git today command: https://github.com/doctorallen/dotfiles/blob/master/.gitconfig#L49 | |
root=$1 | |
if [ -n "$root"] | |
then | |
echo "Error: please define the root directory location for your report." | |
read root | |
fi | |
lastchar=${#root}-1 | |
if [ "${lastchar}" != "/" ]; then | |
echo "Warning: You did not add a trailing slash, it was added automatically." | |
root="${root}/" | |
fi | |
cd ${root} | |
echo "Time Tracking Report for $(date +%m-%d-%Y)" | |
for dir in ${root}*/ | |
do | |
cd ${dir} | |
if [ -d ".git" ]; then | |
if [[ -n $(git today) ]]; then | |
project=${dir%*/} | |
echo ${project##*/} | |
git today | |
fi | |
fi | |
done |
Thanks for the suggestions 😄
I have implemented both of your suggestions.
Awesome! Thanks Dave.
It looks great!
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I know this was just a quick thing to see if you could do it, but a couple things here:
env
command. I tend to run a newer version of bash on a lot of my machines in/usr/local/bin
, so using theenv
command will allow me to run the newer/faster bash. More info: http://en.wikipedia.org/wiki/Shebang_%28Unix%29#Portability