-
-
Save pmeinhardt/4863326ceadd8dd08463b60511e4a541 to your computer and use it in GitHub Desktop.
Find out what you did today
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 | |
# | |
# Find out what you did today | |
# | |
# Lists all your commits from repos found in the given paths. | |
# Use it to prepare your daily stand-up or to write job logs. | |
# | |
# Uses `git`, depends on `fd` - install via `brew install fd`. | |
# | |
# Usage: | |
# | |
# hmm [--max-depth depth] [--since duration] [path...] | |
# | |
# Examples: | |
# | |
# hmm --since '1 week ago' ~/code/project-x | |
# hmm | fzf --multi | |
# hmm | vim - | |
# hmm | ruby -e 'print STDIN.readlines.map(&:strip).join("; ")' | pbcopy | |
set -o errexit | |
set -o pipefail | |
set -o nounset | |
# For debugging, uncomment: | |
# set -o xtrace | |
# Configure defaults | |
maxdepth=3 | |
since='1 day ago' | |
# Utility functions | |
function usage { | |
echo "Usage: hmm [--max-depth depth] [--since duration] [path...]" 1>&2 | |
exit 0 | |
} | |
# Parse arguments | |
while [ $# -gt 0 ]; do | |
case "$1" in | |
--max-depth) | |
shift | |
maxdepth="$1" | |
;; | |
--since) | |
shift | |
since="$1" | |
;; | |
--help) | |
usage | |
;; | |
*) | |
break | |
;; | |
esac | |
shift | |
done | |
# Run | |
searchlog="git --git-dir={} --no-pager log --author=\"<\$(git --git-dir={} config user.email)>\" --branches='*' --since='{$since}' --pretty=tformat:'%s'" | |
exec fd \ | |
--max-depth $maxdepth \ | |
--type d \ | |
--hidden \ | |
--exec bash -c "$searchlog" \; \ | |
'^\.git$' \ | |
$* |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment