@forge/cli

11.5.0-next.11-experimental-9e772ae11.5.0-next.23
out/command-line/register-version-commands.js
~out/command-line/register-version-commands.jsModified
+21−9
Index: package/out/command-line/register-version-commands.js
===================================================================
--- package/out/command-line/register-version-commands.js
+++ package/out/command-line/register-version-commands.js
@@ -1,8 +1,9 @@
 "use strict";
 Object.defineProperty(exports, "__esModule", { value: true });
 exports.registerCommands = exports.parseMajorVersion = void 0;
 const cli_shared_1 = require("@forge/cli-shared");
+const command_1 = require("./command");
 function parseMajorVersion(majorVersionStr, property) {
     if (!/^\d+$/.test(majorVersionStr)) {
         throw new cli_shared_1.ValidationError(cli_shared_1.Text.version.check.error.invalidMajorVersion(property));
     }
@@ -19,11 +20,11 @@
         .description(cli_shared_1.Text.version.check.desc)
         .requireAppId()
         .environmentOption()
         .nonInteractiveOption()
-        .option('-v, --major-version [version]', cli_shared_1.Text.version.check.option.majorVersion)
+        .option('-v, --major-version <version>', cli_shared_1.Text.version.check.option.majorVersion)
         .option('--json', cli_shared_1.Text.version.check.option.json)
-        .option('-f, --out-file [outFile]', cli_shared_1.Text.version.check.option.outFile)
+        .option('-f, --out-file <outFile>', cli_shared_1.Text.version.check.option.outFile)
         .action(async ({ environment, majorVersion, json, outFile, nonInteractive }) => {
         const majorVersionInt = majorVersion ? parseMajorVersion(majorVersion) : undefined;
         await versionController.getAppVersionDetails({
             environment,
@@ -41,9 +42,9 @@
         .requireAppId()
         .environmentOption()
         .nonInteractiveOption()
         .option('--json', cli_shared_1.Text.version.list.option.json)
-        .option('-f, --out-file [outFile]', cli_shared_1.Text.version.list.option.outFile)
+        .option('-f, --out-file <outFile>', cli_shared_1.Text.version.list.option.outFile)
         .action(async ({ environment, json, outFile, nonInteractive }) => {
         await versionController.getVersionList({ environment, json, outFile, nonInteractive });
     });
 };
@@ -110,25 +111,36 @@
             nonInteractive
         });
     });
 };
-const registerDiffCommands = (parent, { controllers: { versionController } }) => {
+const registerDiffCommands = (parent, { controllers: { versionController, defaultEnvironmentController } }) => {
     parent
         .command(cli_shared_1.Text.version.diff.cmdName)
         .description(cli_shared_1.Text.version.diff.desc)
         .requireAppId()
         .environmentOption()
         .nonInteractiveOption()
-        .option('-v1, --version1 [version]', cli_shared_1.Text.version.diff.option.version1)
-        .option('-v2, --version2 [version]', cli_shared_1.Text.version.diff.option.version2)
-        .option('-f, --out-file [outFile]', cli_shared_1.Text.version.diff.option.outFile)
-        .action(async ({ environment, version1, version2, outFile }) => {
+        .option('-v1, --version1 <version>', cli_shared_1.Text.version.diff.option.version1)
+        .option('-v2, --version2 <version>', cli_shared_1.Text.version.diff.option.version2)
+        .option('--environment1 <environment>', cli_shared_1.Text.version.diff.option.environment1)
+        .precondition((0, command_1.environmentPrecondition)('environment1', defaultEnvironmentController))
+        .option('--environment2 <environment>', cli_shared_1.Text.version.diff.option.environment2)
+        .precondition((0, command_1.environmentPrecondition)('environment2', defaultEnvironmentController))
+        .option('-f, --out-file <outFile>', cli_shared_1.Text.version.diff.option.outFile)
+        .action(async ({ environment, version1, version2, outFile, environment1, environment2 }) => {
         if (!version1 || !version2) {
             throw new cli_shared_1.ValidationError(cli_shared_1.Text.version.diff.error.noVersionProvided);
         }
         const version1Int = parseMajorVersion(version1, '--version1');
         const version2Int = parseMajorVersion(version2, '--version2');
-        await versionController.getAppVersionDiff({ environment, version1: version1Int, version2: version2Int, outFile });
+        await versionController.getAppVersionDiff({
+            environment,
+            version1: version1Int,
+            version2: version2Int,
+            outFile,
+            environment1,
+            environment2
+        });
     });
 };
 const registerCommands = (deps) => {
     const { cmd } = deps;