balena-cli
Version:
The official balena Command Line Interface
40 lines (38 loc) • 1.27 kB
JavaScript
Object.defineProperty(exports, "__esModule", { value: true });
const core_1 = require("@oclif/core");
const lazy_1 = require("../../utils/lazy");
class DeviceRenameCmd extends core_1.Command {
async run() {
const { args: params } = await this.parse(DeviceRenameCmd);
const balena = (0, lazy_1.getBalenaSdk)();
const newName = params.newName ||
(await (0, lazy_1.getCliForm)().ask({
message: 'How do you want to name this device?',
type: 'input',
})) ||
'';
await balena.models.device.rename(params.uuid, newName);
}
}
DeviceRenameCmd.description = (0, lazy_1.stripIndent) `
Rename a device.
Rename a device.
Note, if the name is omitted, it will be prompted for interactively.
`;
DeviceRenameCmd.examples = [
'$ balena device rename 7cf02a6',
'$ balena device rename 7cf02a6 MyPi',
];
DeviceRenameCmd.args = {
uuid: core_1.Args.string({
description: 'the uuid of the device to rename',
required: true,
}),
newName: core_1.Args.string({
description: 'the new name for the device',
}),
};
DeviceRenameCmd.authenticated = true;
exports.default = DeviceRenameCmd;
//# sourceMappingURL=rename.js.map
;