balena-cli/lib/actions/notes.coffee

18 lines
435 B
CoffeeScript
Raw Normal View History

2014-12-24 16:40:40 +00:00
async = require('async')
permissions = require('../permissions/permissions')
helpers = require('../helpers/helpers')
2015-01-08 12:04:37 +00:00
resin = require('resin-sdk')
2014-12-24 16:40:40 +00:00
exports.set = permissions.user (params, options, done) ->
2014-12-24 16:40:40 +00:00
async.waterfall([
(callback) ->
if not params.note?
return helpers.readStdin(callback)
2014-12-24 16:40:40 +00:00
return callback(null, params.note)
(note, callback) ->
resin.models.device.note(options.device, note, callback)
], done)