3 USAGE
="$0"' <options>...
5 Get the amount of kB used by the msysGit organization
8 --user <github-account> (required)
18 echo "Option '$1' needs a value" >&2
26 eval ${pair%%=*}="${pair#*=}"
39 user
="$(grep -A2 -i '^machine *api.github.com' < "$HOME/.netrc
" 2> /dev/null |
40 sed -n 's|login *||pi')"
47 get_password
() { # args: user host
48 # try $HOME/.netrc; ignore <user> parameter first
49 password
="$(grep -A2 -i "^machine
*$2" < $HOME/.netrc 2> /dev/null |
50 sed -n 's|^password *||p')"
51 test -z "$password" &&
52 password
="$(git gui--askpass "Password
for $1@
$2")"
56 json_get
() { # args: key json
59 -e "s|^ *\"$1\" *: *\"\(.*\)\",\?$|\1|p" \
60 -e "s|^ *\"$1\" *: *\([^\"]*[^\",]\),\?$|\1|p"
63 password
="$(get_password "$user" "api.github.com
")"
64 test -n "$password" ||
exit
71 -u "$user:$password" \
72 https://api.github.com/orgs/msysgit)"
74 echo "Disk usage: $(json_get disk_usage "$json")kB"