UNPKG

balena-cli

Version:

The official balena Command Line Interface

51 lines (49 loc) 1.85 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const core_1 = require("@oclif/core"); const errors_1 = require("../../errors"); const cf = require("../../utils/common-flags"); const lazy_1 = require("../../utils/lazy"); class DeviceNoteCmd extends core_1.Command { async run() { var _a, _b; const { args: params, flags: options } = await this.parse(DeviceNoteCmd); if (((_a = params.note) === null || _a === void 0 ? void 0 : _a.length) === 0) { throw new errors_1.ExpectedError('Missing note content'); } options.device = options.device || options.dev; delete options.dev; if (options.device == null || options.device.length === 0) { throw new errors_1.ExpectedError('Missing device UUID (--device)'); } const balena = (0, lazy_1.getBalenaSdk)(); return balena.models.device.setNote(options.device, (_b = params.note) !== null && _b !== void 0 ? _b : ''); } } DeviceNoteCmd.aliases = ['notes']; DeviceNoteCmd.deprecateAliases = true; DeviceNoteCmd.description = (0, lazy_1.stripIndent) ` Set a device note. Set or update a device note. If the note argument is not provided, it will be read from stdin. To view device notes, use the \`balena device <uuid>\` command. `; DeviceNoteCmd.examples = [ '$ balena device note "My useful note" --device 7cf02a6', '$ cat note.txt | balena device note --device 7cf02a6', ]; DeviceNoteCmd.args = { note: core_1.Args.string({ description: 'note content', }), }; DeviceNoteCmd.flags = { device: { exclusive: ['dev'], ...cf.device }, dev: core_1.Flags.string({ exclusive: ['device'], hidden: true, }), }; DeviceNoteCmd.authenticated = true; exports.default = DeviceNoteCmd; //# sourceMappingURL=note.js.map