index.js
function getAuthToken () {
  console.log('You have hit the rate limit for unauthenticated requests, please log in to raise your rate limit:\n'.red);

  program.prompt('GitHub Username: ', function (user) {

    console.log('\nAfter entering your password, hit return' + ' twice.\n'.green);
    var authProcess = spawn('curl', [
      '-u',
      user,
      '-d',
      '{"scopes":["repo"],"note":"mdlint"}',
      '-s',
      'https://api.github.com/authorizations'
    ], {
      stdio: [process.stdin, 'pipe', process.stderr]
    });

    authProcess.stdout.setEncoding('utf8');
    authProcess.stdout.on('data', function (data) {
      var response = JSON.parse(data);
      if (response.message) {
        console.log(response.message.red + '\n');
        process.exit();
      } else {
        fs.writeFileSync(tokenFile, response.token);
        console.log('Authenticated :). Now try your lint again. \n'.green);
        process.exit();
      }
    });
  });
}
function getAuthToken () {
  console.log('You have hit the rate limit for unauthenticated requests, please log in to raise your rate limit:\n'.red);

  program.prompt('GitHub Username: ', function (user) {

    console.log('\nAfter entering your password, hit return' + ' twice.\n'.green);
    var authProcess = spawn('curl', [
      '-u',
      user,
      '-d',
      '{"scopes":["repo"],"note":"mdlint"}',
      '-s',
      'https://api.github.com/authorizations'
    ], {
      stdio: [process.stdin, 'pipe', process.stderr]
    });

    authProcess.stdout.setEncoding('utf8');
    authProcess.stdout.on('data', function (data) {
      var response = JSON.parse(data);
      if (response.message) {
        console.log(response.message.red + '\n');
        process.exit();
      } else {
        fs.writeFileSync(tokenFile, response.token);
        console.log('Authenticated :). Now try your lint again. \n'.green);
        process.exit();
      }
    });
  });
}
function getAuthToken ( ) { console . log ( 'You have hit the rate limit for unauthenticated requests, please log in to raise your rate limit:\n' . red ) ; program . prompt ( 'GitHub Username: ' , function ( user ) { console . log ( '\nAfter entering your password, hit return' + ' twice.\n' . green ) ; var authProcess = spawn ( 'curl' , [ '-u' , user , '-d' , '{"scopes":["repo"],"note":"mdlint"}' , '-s' , 'https://api.github.com/authorizations' ] , { stdio : [ process . stdin , 'pipe' , process . stderr ] } ) ; authProcess . stdout . setEncoding ( 'utf8' ) ; authProcess . stdout . on ( 'data' , function ( data ) { var response = JSON . parse ( data ) ; if ( response . message ) { console . log ( response . message . red + '\n' ) ; process . exit ( ) ; } else { fs . writeFileSync ( tokenFile , response . token ) ; console . log ( 'Authenticated :). Now try your lint again. \n' . green ) ; process . exit ( ) ; } } ) ; } ) ; }
Retrieves an auth token so that the user can exceed the uauthenticated rate limit
Retrieves an auth token so that the user can exceed the uauthenticated rate limit