Last active
November 22, 2018 05:14
-
-
Save wifeofvillon/99de5fe7e6222aed83bed88da3ae3f24 to your computer and use it in GitHub Desktop.
This file contains 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/sh | |
user_name="user_name" | |
token="user_token" | |
graph_id="graph_name" | |
quantity=`git shortlog -sn --no-merges --since='$(date +%Y/%m/%d) 00:00:00'` | awk '{print $1}' | |
echo $quantity | |
echo "counted commits." | |
if [ -n $quantity ] ; then | |
today=`date '+%Y%m%d'` | |
echo "date: ${today}, quantity: ${quantity}" | |
read -p "post it? (y/n)" yn | |
case "$yn" in [yY]*) ;; *) echo "abort." ; exit ;; esac | |
# failed to parse parameters | |
# curl -X POST https://pixe.la/v1/users/${user_name}/graphs/${graph_id} -H 'X-USER-TOKEN:${token}' -d '{"date":"${date}","quantity":"${quantity}"}' | |
cat <<EOS | |
use it! | |
curl -X POST https://pixe.la/v1/users/${user_name}/graphs/${graph_id} -H 'X-USER-TOKEN:${token}' -d '{"date":"${date}","quantity":"${quantity}"}' | |
EOS | |
echo "\n" | |
fi | |
## example of result | |
# $ sh github.wiki.pixela.sh | |
# 5 | |
# counted commits. | |
# date: 20181114, quantity: 5 | |
# post it? (y/n)y | |
# use it! | |
# curl -X POST https://pixe.la/v1/users/wifeofvillon/graphs/test-graph -H 'X-USER-TOKEN:user_token' -d '{"date":"20181114","quantity":"5"}' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
When I executed
git shortlog
, I got a stream like follow: