mirror of
https://github.com/balena-io/balena-cli.git
synced 2024-12-29 18:18:50 +00:00
17 lines
330 B
CoffeeScript
17 lines
330 B
CoffeeScript
resin = require('resin-sdk')
|
|
|
|
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)
|