UNPKG

balena-cli

Version:

The official balena Command Line Interface

49 lines (47 loc) 1.61 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const core_1 = require("@oclif/core"); const lazy_1 = require("../../utils/lazy"); class OrganizationRenameCmd extends core_1.Command { async run() { const { args: params } = await this.parse(OrganizationRenameCmd); const balena = (0, lazy_1.getBalenaSdk)(); const newName = params.newName || (await (0, lazy_1.getCliForm)().ask({ message: 'How do you want to name this organization?', type: 'input', })) || ''; const org = await balena.models.organization.get(params.handle, { $select: 'id', }); await balena.pine.patch({ resource: 'organization', id: org.id, body: { name: newName, }, }); } } OrganizationRenameCmd.description = (0, lazy_1.stripIndent) ` Rename an organization. Rename an organization. Note, if the name is omitted, it will be prompted for interactively. `; OrganizationRenameCmd.examples = [ '$ balena organization rename my_org_handle', '$ balena organization rename my_org_handle "My New Org"', ]; OrganizationRenameCmd.args = { handle: core_1.Args.string({ description: 'the handle of the organization to rename', required: true, }), newName: core_1.Args.string({ description: 'the new name for the organization', }), }; OrganizationRenameCmd.authenticated = true; exports.default = OrganizationRenameCmd; //# sourceMappingURL=rename.js.map