Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
add GitHub authentication to exceed rate-limiting
- Loading branch information
Showing
5 changed files
with
47 additions
and
11 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
var read = require('read') | ||
, colors = require('colors') | ||
|
||
, auth = function (config, callback) { | ||
console.log('To collect GitHub stats we need you to authenticate so we can exceed API rate-limiting.'.bold.green) | ||
console.log('Leave the username field blank to skip stats collection.'.bold.green) | ||
console.log() | ||
|
||
read({ prompt: 'GitHub username:'.bold }, function (err, data) { | ||
if (err) return callback(err) | ||
if (data === '') return callback() | ||
config.ghUser = data | ||
read({ prompt: 'GitHub password:'.bold, silent: true, replace: '\u2714' }, function (err, data) { | ||
if (err) return callback(err) | ||
config.ghPass = data | ||
callback() | ||
}) | ||
}) | ||
} | ||
|
||
module.exports = auth |
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
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
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