balena-cli/lib/permissions/permissions.coffee
2014-12-19 09:15:38 -04:00

17 lines
329 B
CoffeeScript

resin = require('../resin')
exports.user = (fn, onError) ->
return ->
args = arguments
resin.auth.isLoggedIn (isLoggedIn) ->
if not isLoggedIn
error = new Error('You have to log in')
if onError?
return onError(error)
else
console.error(error.message)
process.exit(1)
fn.apply(null, args)