balena-cli/lib/actions/notes.coffee
2015-01-09 15:07:50 -03:00

19 lines
475 B
CoffeeScript

async = require('async')
permissions = require('../permissions/permissions')
errors = require('../errors/errors')
helpers = require('../helpers/helpers')
resin = require('resin-sdk')
exports.set = permissions.user (params, options) ->
async.waterfall([
(callback) ->
if not params.note?
return helpers.readStdin(callback)
return callback(null, params.note)
(note, callback) ->
resin.models.device.note(options.device, note, callback)
], errors.handle)