UNPKG

@sap/cli-core

Version:

Command-Line Interface (CLI) Core Module

26 lines (25 loc) 1 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.create = void 0; const config_1 = require("../../config"); const constants_1 = require("../../constants"); const utils_1 = require("../../utils/utils"); const next_1 = require("./next"); const options_1 = require("./options"); const MANDATORY_OPTIONS = [ constants_1.OPTION_VERBOSE, constants_1.OPTION_OPTIONS_FILE, { ...constants_1.OPTION_HOST, required: true }, ]; const post = async () => async () => { const config = (0, config_1.get)(); const tenant = (0, utils_1.parseTenant)(config.options[constants_1.OPTION_HOST.longName]); const info = (0, utils_1.getInfoFromTenant)(tenant, config.verbose); for (const [key, value] of Object.entries(info)) { if (!config[key]) { (0, config_1.set)({ [key]: value }); } } }; const create = () => (0, next_1.create)("mandatoryOptions.handler", (0, options_1.create)(MANDATORY_OPTIONS), post); exports.create = create;