paulirish/github-email

Email format, silent mode, and null suppression

Closed this issue · 3 comments

A few ideas to consider:

  • Make curl operate in silent mode.
  • Use jq to parse the data, rather than sed and grep.
  • Format the email address to be compatible with most e-mail clients.
  • Suppress null results.

For example:

#!/bin/bash
curl -s https://api.github.com/users/$1/events/public | \
  jq -r '.[] | select(.payload != null) | .payload | select(.commits != null) | .commits[].author | .name + " <" + .email + ">"' | \
  sort | uniq

sound great! want to make a pull request?

See #13, which includes:

  • Passing GitHub API token as parameter to REST API calls
  • Documentation simplifications to avoid duplication of instructional information
  • Command-line argument passing POSIX-style, and other minor POSIX-compatibility changes
  • Allow user to provide GitHub API token on the command line using the -t option
  • Store GitHub API token in a file if the default GITHUB_TOKEN environment variable is missing
  • Colour definitions
  • Source formatting (replaced tabs with two spaces)
  • Eliminated various duplicated code segments
  • Changed "fade" to "warning"

PR #13 (5adcd7d) now resolves this issue. Updates include:

  • Check for required software (jq and curl)
  • Standard name/email format
  • Parse json using jq instead of sed
  • Suppress printing empty/invalid results

Sample output:

screenshot

Here's a before (right) and after (left) shot:

before-after