mirror of
https://github.com/balena-io/balena-cli.git
synced 2024-12-20 14:13:07 +00:00
22 lines
552 B
CoffeeScript
22 lines
552 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) ->
|
|
if not options.device?
|
|
errors.handle(new Error('You have to specify a device'))
|
|
|
|
async.waterfall([
|
|
|
|
(callback) ->
|
|
if not params.note?
|
|
helpers.readStdin(callback)
|
|
return callback(null, params.note)
|
|
|
|
(note, callback) ->
|
|
resin.models.device.note(options.device, note, callback)
|
|
|
|
], errors.handle)
|