mirror of
https://github.com/balena-io/balena-cli.git
synced 2025-01-19 11:16:38 +00:00
Make use of new Capitano stdin support to get rid of helpers/
This commit is contained in:
parent
8275275a05
commit
65fbe12f22
@ -3,7 +3,7 @@ _.str = require('underscore.string')
|
||||
async = require('async')
|
||||
fs = require('fs')
|
||||
resin = require('resin-sdk')
|
||||
helpers = require('../helpers/helpers')
|
||||
capitano = require('capitano')
|
||||
visuals = require('resin-cli-visuals')
|
||||
commandOptions = require('./command-options')
|
||||
|
||||
@ -84,7 +84,8 @@ exports.add =
|
||||
if params.path?
|
||||
fs.readFile(params.path, encoding: 'utf8', callback)
|
||||
else
|
||||
helpers.readStdin(callback)
|
||||
capitano.utils.getStdin (data) ->
|
||||
return callback(null, data)
|
||||
|
||||
(key, callback) ->
|
||||
resin.models.key.create(params.name, key, callback)
|
||||
|
@ -1,9 +1,8 @@
|
||||
async = require('async')
|
||||
helpers = require('../helpers/helpers')
|
||||
resin = require('resin-sdk')
|
||||
|
||||
exports.set =
|
||||
signature: 'note [note]'
|
||||
signature: 'note <|note>'
|
||||
description: 'set a device note'
|
||||
help: '''
|
||||
Use this command to set or update a device note.
|
||||
@ -25,14 +24,4 @@ exports.set =
|
||||
]
|
||||
permission: 'user'
|
||||
action: (params, options, done) ->
|
||||
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)
|
||||
|
||||
], done)
|
||||
resin.models.device.note(options.device, params.note, done)
|
||||
|
@ -1,5 +0,0 @@
|
||||
getStdin = require('get-stdin')
|
||||
|
||||
exports.readStdin = (callback) ->
|
||||
getStdin (result) ->
|
||||
return callback(null, result)
|
@ -46,7 +46,7 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"async": "~0.9.0",
|
||||
"capitano": "~1.3.1",
|
||||
"capitano": "~1.5.0",
|
||||
"coffee-script": "~1.8.0",
|
||||
"conf.js": "^0.1.1",
|
||||
"diskio": "^1.0.0",
|
||||
|
Loading…
Reference in New Issue
Block a user