UNPKG

balena-cli

Version:

The official balena Command Line Interface

42 lines (41 loc) 1.37 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const core_1 = require("@oclif/core"); const cf = require("../../utils/common-flags"); const lazy_1 = require("../../utils/lazy"); const errors_1 = require("../../errors"); class DeviceShutdownCmd extends core_1.Command { async run() { var _a; const { args: params, flags: options } = await this.parse(DeviceShutdownCmd); const balena = (0, lazy_1.getBalenaSdk)(); try { await balena.models.device.shutdown(params.uuid, options); } catch (e) { if ((_a = e.message) === null || _a === void 0 ? void 0 : _a.toLowerCase().includes('online')) { throw new errors_1.ExpectedError(`Device ${params.uuid} is not online`); } else { throw e; } } } } DeviceShutdownCmd.description = (0, lazy_1.stripIndent) ` Shutdown a device. Remotely shutdown a device. `; DeviceShutdownCmd.examples = ['$ balena device shutdown 23c73a1']; DeviceShutdownCmd.args = { uuid: core_1.Args.string({ description: 'the uuid of the device to shutdown', required: true, }), }; DeviceShutdownCmd.flags = { force: cf.force, }; DeviceShutdownCmd.authenticated = true; exports.default = DeviceShutdownCmd; //# sourceMappingURL=shutdown.js.map