Skip to content

Commit

Permalink
Make init command doesn't require login
Browse files Browse the repository at this point in the history
Fix #306
  • Loading branch information
tamorim committed Jun 5, 2017
1 parent 9b11910 commit 97881ee
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import log from './logger'
import tree from './modules'
import notify from './update'
import {getToken} from './conf'
import initCmd from './modules/init/'
import loginCmd from './modules/auth/login'
import logoutCmd from './modules/auth/logout'
import switchCmd from './modules/auth/switch'
Expand Down Expand Up @@ -44,7 +45,7 @@ const checkCommandExists = found =>
!found.command ? Promise.reject({name: 'CommandNotFound'}) : null

const checkLogin = found => {
const whitelist = [tree, loginCmd, logoutCmd, switchCmd, whoamiCmd]
const whitelist = [tree, loginCmd, logoutCmd, switchCmd, whoamiCmd, initCmd]
if (!getToken() && whitelist.indexOf(found.command) === -1) {
log.debug('Requesting login before command:', process.argv.slice(2).join(' '))
return run({command: loginCmd})
Expand Down

0 comments on commit 97881ee

Please sign in to comment.