heroku-cli-util
Advanced tools
Comparing version 2.0.0 to 2.0.1
{ | ||
"name": "heroku-cli-util", | ||
"version": "2.0.0", | ||
"version": "2.0.1", | ||
"description": "Set of helpful CLI utilities", | ||
@@ -5,0 +5,0 @@ "main": "cli.js", |
'use strict'; | ||
let Heroku = require('heroku-client'); | ||
let prompt = require('./prompt'); | ||
let util = require('./util'); | ||
module.exports = function preauth (app, token, cb) { | ||
prompt('Two-factor code', function (second_factor) { | ||
let heroku = new Heroku({token: token}); | ||
return heroku.request({ | ||
method: 'PUT', | ||
path: `/apps/${app}/pre-authorizations`, | ||
headers: { | ||
'Heroku-Two-Factor-Code': second_factor | ||
} | ||
}, cb); | ||
function preauth (app, heroku) { | ||
return new Promise(function (fulfill, reject) { | ||
prompt.prompt('Two-factor code').then(function (second_factor) { | ||
fulfill(heroku.request({ | ||
method: 'PUT', | ||
path: `/apps/${app}/pre-authorizations`, | ||
headers: { | ||
'Heroku-Two-Factor-Code': second_factor | ||
} | ||
})); | ||
}).catch(reject); | ||
}); | ||
}; | ||
} | ||
module.exports = util.promiseOrCallback(preauth); |
@@ -140,8 +140,5 @@ # heroku-cli-util | ||
var h = require('heroku-cli-util'); | ||
h.preauth("APPNAME", "APITOKEN", function (err) { | ||
console.log('preauthed'); | ||
}); | ||
yield h.preauth("APPNAME", heroku); | ||
``` | ||
## Tests | ||
@@ -148,0 +145,0 @@ |
@@ -12,3 +12,3 @@ require('chai').should(); | ||
errors.error('foobar'); | ||
console.stderr.should.contain(' \u001b[41m!\u001b[49m foobar\n'); | ||
console.stderr.should.contain(' ! foobar\n'); | ||
}); | ||
@@ -18,4 +18,4 @@ | ||
errors.warn('foobar'); | ||
console.stderr.should.contain(' \u001b[43m!\u001b[49m foobar\n'); | ||
console.stderr.should.contain(' ! foobar\n'); | ||
}); | ||
}); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
392
16164
153