Browse Source

Fix edge case where `--token` was being ignored (#840)

* Fix edge case where `--token` was being ignored

* Fix logic
master
Matheus Fernandes 8 years ago
committed by GitHub
parent
commit
80e1ee829f
  1. 14
      src/now.js

14
src/now.js

@ -403,10 +403,20 @@ const main = async (argv_) => {
process.exit(1)
}
ctx.authConfig.credentials.push({
const obj = {
provider: 'sh',
token
})
}
const credentialsIndex = ctx.authConfig.credentials.findIndex(
cred => cred.provider === 'sh'
)
if (credentialsIndex === -1) {
ctx.authConfig.credentials.push(obj)
} else {
ctx.authConfig.credentials[credentialsIndex] = obj
}
if (isTTY) {
console.log(info('Caching account information...'))

Loading…
Cancel
Save