UNPKG

@controlplane/cli

Version:

Control Plane Corporation CLI

46 lines 1.74 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.VersionCmd = void 0; const command_1 = require("../cli/command"); const format_1 = require("../format/format"); const version_1 = require("../util/version"); // ANCHOR - Command /** * Prints the installed cpln build information, byte-for-byte identical to * `cpln --version`. The CLI entry point computes the version string once and * injects it as `_version`, so the two outputs can never drift. * * Like `cpln upgrade`, this command must run on a machine that has never logged * in, so it writes through this.env and never touches this.session — the session * getter throws when no profile is configured. */ class VersionCmd extends command_1.Command { constructor() { super(...arguments); this.command = 'version'; this.describe = 'Print the installed cpln version'; } // Public Methods // /** * Registers no options; `cpln version` mirrors the argument-free `--version`. * * @param {Argv} yargs - The yargs instance. * @returns {Argv} The unchanged yargs instance. */ builder(yargs) { return yargs; } /** * Prints the version information, identical to `cpln --version`. * * @param {Arguments<VersionArgs>} args - The parsed arguments, carrying the injected `_version`. * @returns {void} */ handle(args) { var _a; // The entry point injects the exact --version string; About is a defensive fallback (0, format_1.write)(this.env.out, (_a = args._version) !== null && _a !== void 0 ? _a : JSON.stringify(version_1.About, null, 2)); } } exports.VersionCmd = VersionCmd; //# sourceMappingURL=version.js.map