UNPKG

balena-cli

Version:

The official balena Command Line Interface

71 lines (69 loc) 2.54 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const core_1 = require("@oclif/core"); const cf = require("../../utils/common-flags"); const ca = require("../../utils/common-args"); const lazy_1 = require("../../utils/lazy"); const messages_1 = require("../../utils/messages"); class FleetCmd extends core_1.Command { async run() { var _a; const { args: params, flags: options } = await this.parse(FleetCmd); const { getApplication } = await Promise.resolve().then(() => require('../../utils/sdk')); const balena = (0, lazy_1.getBalenaSdk)(); const application = await getApplication(balena, params.fleet, { $expand: { is_for__device_type: { $select: 'slug' }, should_be_running__release: { $select: 'commit' }, }, }); if (options.view) { const open = await Promise.resolve().then(() => require('open')); const dashboardUrl = balena.models.application.getDashboardUrl(application.id); await open(dashboardUrl, { wait: false }); return; } const applicationToDisplay = { id: application.id, app_name: application.app_name, slug: application.slug, device_type: application.is_for__device_type[0].slug, commit: (_a = application.should_be_running__release[0]) === null || _a === void 0 ? void 0 : _a.commit, }; if (options.json) { console.log(JSON.stringify(applicationToDisplay, null, 4)); return; } console.log(`== ${applicationToDisplay.app_name}`); console.log((0, lazy_1.getVisuals)().table.vertical(applicationToDisplay, [ 'id', 'device_type', 'slug', 'commit', ])); } } FleetCmd.description = (0, lazy_1.stripIndent) ` Display information about a single fleet. Display detailed information about a single fleet. ${messages_1.applicationIdInfo.split('\n').join('\n\t\t')} `; FleetCmd.examples = [ '$ balena fleet MyFleet', '$ balena fleet myorg/myfleet', '$ balena fleet myorg/myfleet --view', ]; FleetCmd.args = { fleet: ca.fleetRequired, }; FleetCmd.flags = { view: core_1.Flags.boolean({ default: false, description: 'open fleet dashboard page', }), json: cf.json, }; FleetCmd.authenticated = true; FleetCmd.primary = true; exports.default = FleetCmd; //# sourceMappingURL=index.js.map