-
Notifications
You must be signed in to change notification settings - Fork 1
/
gstats
executable file
·25 lines (21 loc) · 1.11 KB
/
gstats
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#!/bin/sh
set -e
cat repo | awk '{print "Url: "$0}'
cat repo | sed 's|https://[^/]*/\([^/]*\)/\([^/]*\)|Author: \1#Repo: \2|' | tr '#' '\n'
echo ""
if cat repo | grep -q '//github.com/'; then
cat repo|head -n1| sed 's|github.com|api.github.com/repos|' | xargs curl > /tmp/gh-repo-page
jq -r '.description' /tmp/gh-repo-page | awk '{print "Description: "$0}'
jq -r '.watchers,.forks,.subscribers_count' /tmp/gh-repo-page |
xargs echo | awk '{print "Starred: "$1"\nForked: "$2"\nWatching: "$3}'
# printf "Top Languages: "
# cat /tmp/gh-repo-page|grep 'Progress-item'|grep -o 'aria-label="[^"]*' | head -n5 | awk -F'"' '{print $2"% | "}' | xargs echo | sed 's/..$//'
fi
cd crepo || exit 1
echo "Total commits: $(git rev-list --count HEAD)"
echo "Initial commit: $(git log --oneline|tail -1|awk '{print $1}'|xargs git show|grep -E '^Date:'|sed 's|Date:\ *||')"
echo "Total number of files: $(find . -type f|grep -v '.git/'|wc -l)"
echo "Total number of lines: $(find . -type f|grep -v '.git/'|xargs cat|wc -l)"
# echo "Number of contributers: $(git shortlog -sn|wc -l)"
# echo "Top 5 contributers:"
# git shortlog -sn|head -n5