Skip to content

Instantly share code, notes, and snippets.

@jhonatasfender
Last active December 9, 2021 12:44
Show Gist options
  • Save jhonatasfender/36f70d9369ad4c134ba3f700c139280f to your computer and use it in GitHub Desktop.
Save jhonatasfender/36f70d9369ad4c134ba3f700c139280f to your computer and use it in GitHub Desktop.
#!/bin/sh
clear
arr=(
"projects"
"projects"
)
echo "Data Inicial: "
read dateInit
if [ -z "$dateInit" ]
then
dateInit="2020-07-28"
fi
final=$(date +%Y-%m-$(cal $(date +"%m %Y") | awk 'NF {DAYS = $NF}; END {print DAYS}'))
echo "Data Final: ($final)"
read dateFinal
if [ -z "$dateFinal" ]
then
dateFinal=$final
fi
for i in "${arr[@]}"; do
cd $i
echo "\033[1;31m"
printf '#%.0s' {1..100}
echo ""
pwd
printf '#%.0s' {1..100}
echo "\033[m"
# TODO: --after=$(date +%Y-%m-01) --before=$(date +%Y-%m-$(cal $(date +"%m %Y") | awk 'NF {DAYS = $NF}; END {print DAYS}'))
commits=$(
git log --no-merges --pretty='format:%H' \
--author=$(git config user.email) \
--after=$dateInit --before=$dateFinal
)
project=$(basename $(git rev-parse --show-toplevel))
for commit in $commits; do
show=$(git show --name-status --no-merges --author=$(git config user.email) --pretty='format:' $commit)
IFS=';' read -ra ADDR <<<"$show"
for file in "${ADDR[@]}"; do
replace=" ====>> $project/-/blob/$commit/"
echo "$file" | sed -e "s# #$replace#g"
done
done
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment