Skip to content

Commit

Permalink
color.
Browse files Browse the repository at this point in the history
  • Loading branch information
paulirish committed Mar 21, 2018
1 parent ddb8f03 commit 15c9906
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 10 deletions.
21 changes: 12 additions & 9 deletions github-email.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,38 +13,41 @@ if [[ $# -eq 0 ]]; then
printf "Usage: %s username [repository]\n" "$(basename "$0")" >&2
exit 1
fi
clear='\033[0m'

log() {
faded='\033[1;30m'
clear='\033[0m'
printf "\n%b$1%b\n" "$faded" "$clear"
fade() {
faded='\033[30m'
printf "%b$1%b\n" "$faded" "$clear"
}

header() {
pink='\033[1;35m'
printf "\n%b$1%b\n" "$pink" "$clear"
}

user="$1"
repo="$2"


log 'Email on GitHub'
header 'Email on GitHub'
curl "https://api.github.com/users/$user" -s \
| sed -nE 's#^.*"email": "([^"]+)",.*$#\1#p'


log 'Email on npm'
header 'Email on npm'
if hash jq 2>/dev/null; then
curl "https://registry.npmjs.org/-/user/org.couchdb.user:$user" -s | jq -r '.email'
else
echo " … skipping …. Please: brew install jq"
fi


log 'Emails from recent commits'
header 'Emails from recent commits'
curl "https://api.github.com/users/$user/events" -s \
| sed -nE 's#^.*"(email)": "([^"]+)",.*$#\2#p' \
| sort -u


log 'Emails from owned-repo recent activity'
header 'Emails from owned-repo recent activity'
if [[ -z $repo ]]; then
# get all owned repos
repo="$(curl "https://api.github.com/users/$user/repos?type=owner&sort=updated" -s \
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@
}
],
"license": "MIT"
}
}

0 comments on commit 15c9906

Please sign in to comment.