"use strict";var t=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(exports,"__esModule",{value:!0}),exports.OhpmCommand=void 0;const e=require("commander"),r=require("../../common/Constants"),n=require("../../config"),o=t(require("../../log")),i=require("../../config/OhpmRcLoader"),s=require("./OhpmOutputConfiguration"),a=`Specify whether to strictly verify SSL certificates when connecting to the ${r.Constants.PM} registry`;class m extends e.Command{constructor(t){super(t),this.subCommands=[]}static getInstance(){return m.ohpmCommand||(m.ohpmCommand=new m),m.ohpmCommand}addSubCommand(t){return t&&this.subCommands.push(t),this}createSubCmd(t){return new m(t)}addRegistryOptions(t){return this.option("--registry <string>",t||"Specify the registry")}addPrefixOptions(t){return this.option("--prefix <string>",t||"Specify the local prefix path")}addParameterFileOptions(t){return this.option("-pf, --parameterFile <string>",t||"Specify the package version parameter file")}addTimeoutOptions(t,e){return this.option("-ft, --fetch_timeout <number>",t||"Specify the timeout duration for the network request").option("--strict_ssl <boolean>",e||a)}addMaxConcurrentOptions(t,e,r){return this.option("-mc, --max_concurrent <number>",t||"Specify the maximum number of active network request").option("-rt, --retry_times <number>",e||"Specify the maximum times for error retry").option("-ri, --retry_interval <number>",r||"Specify the interval time for error retry")}startParse(){return this.globalConfig().cmdParse()}globalConfig(){return this.configureHelp({sortSubcommands:!1,subcommandTerm:t=>t.name()}),this.name(r.Constants.PM).usage("[command] [options]").version(r.Constants.PmVersion,"-v, --version",`output the ${r.Constants.PM} version`).allowExcessArguments(!1).allowUnknownOption(!1)}cmdParse(){return this.subCommands&&this.subCommands.forEach((t=>{t.configureOutput(s.OhpmOutputConfiguration.getInstance()),this.addCommand(t)})),this.parseOptions(process.argv),(0,i.initRc)(),n.config.load(this.opts()),o.default.setup(n.config.get(n.types.LOG_LEVEL)),this.configureOutput(s.OhpmOutputConfiguration.getInstance()),this.parse()}}exports.OhpmCommand=m;