@forge/cli
12.22.0-experimental-04cc2b912.23.0-next.7-experimental-44b7a12
out/command-line/command.js~
out/command-line/command.jsModified+12−6
Index: package/out/command-line/command.js
===================================================================
--- package/out/command-line/command.js
+++ package/out/command-line/command.js
@@ -1,11 +1,7 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
-exports.Command = exports.WrapperError = void 0;
-exports.getAutocompleteConfig = getAutocompleteConfig;
-exports.validateContext = validateContext;
-exports.validateShardContext = validateShardContext;
-exports.environmentPrecondition = environmentPrecondition;
+exports.environmentPrecondition = exports.validateShardContext = exports.validateContext = exports.getAutocompleteConfig = exports.Command = exports.WrapperError = void 0;
const tslib_1 = require("tslib");
const commander_1 = tslib_1.__importStar(require("commander"));
const ari_1 = require("@forge/util/packages/ari");
const semver_1 = tslib_1.__importDefault(require("semver"));
@@ -171,9 +167,15 @@
requireAppId(allowOverride = false) {
if (allowOverride) {
const option = new commander_1.Option('--app-id-override <appId>', cli_shared_1.Text.appIdOverride.desription).argParser((value) => ari_1.EcosystemAppAri.create({ appId: value }).toString());
this.cmd.addOption(option);
- return this;
+ return this.precondition(async (...args) => {
+ const { appIdOverride } = last(args);
+ if (!appIdOverride) {
+ return this.preCommandController.verifyManifestExistsWithAppConfig()();
+ }
+ return { appId: appIdOverride };
+ });
}
return this.precondition(this.preCommandController.verifyManifestExistsWithAppConfig());
}
nonInteractiveOption(...args) {
@@ -474,8 +476,9 @@
}
const options = getOptionsData(cmd);
return { commands, options };
}
+exports.getAutocompleteConfig = getAutocompleteConfig;
function validateContext({ supportedProductsService, site, product }) {
let maybeSupportedProduct = undefined;
let maybeSiteUrl = undefined;
if (product !== undefined) {
@@ -491,8 +494,9 @@
maybeSiteUrl = supportedProductsService.validateSite(site, maybeSupportedProduct);
}
return { site: maybeSiteUrl, product: maybeSupportedProduct };
}
+exports.validateContext = validateContext;
function validateShardContext(shard) {
if (shard) {
const [id, region, ...rest] = shard.split(':');
if (!id || !region || rest.length > 0) {
@@ -501,8 +505,9 @@
return shard;
}
return undefined;
}
+exports.validateShardContext = validateShardContext;
function environmentPrecondition(key, environmentController, requireEnvironmentWithAppIdOverride = false) {
return async (...args) => {
const lastArgs = last(args);
const environmentArg = lastArgs[key];
@@ -517,5 +522,6 @@
const environment = environmentArg || (await environmentController.run(nonInteractive, appId));
return { [key]: (0, environment_1.checkEnvironmentOption)(environment) };
};
}
+exports.environmentPrecondition = environmentPrecondition;
//# sourceMappingURL=command.js.map
\ No newline at end of file