{"version":3,"file":"CommandLineParameterProvider.js","sourceRoot":"","sources":["../../src/providers/CommandLineParameterProvider.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;;;;;;;;;;;;;;;;;;;;;;;;AAE3D,mDAAqC;AAarC,2DAImC;AACnC,yFAAsF;AACtF,iGAA8F;AAC9F,2FAAwF;AACxF,mGAAgG;AAChG,qFAAkF;AAClF,yFAAsF;AACtF,iGAA8F;AAC9F,6EAA0E;AAC1E,4CAAuD;AACvD,6EAA0E;AA6C1E,MAAM,gBAAgB,GAAW,OAAO,CAAC;AACzC,MAAM,oBAAoB,GAAW,UAAU,CAAC;AAChD,MAAM,gCAAgC,GACpC,gFAAgF,CAAC;AAEnF;;;;;GAKG;AACH,MAAsB,4BAA4B;IAmBhD,gBAAgB;IAChB,0EAA0E;IAC1E;QACE,IAAI,CAAC,WAAW,GAAG,EAAE,CAAC;QACtB,IAAI,CAAC,qBAAqB,GAAG,IAAI,GAAG,EAAE,CAAC;QACvC,IAAI,CAAC,sBAAsB,GAAG,IAAI,GAAG,EAAE,CAAC;QACxC,IAAI,CAAC,sBAAsB,GAAG,IAAI,GAAG,EAAE,CAAC;QACxC,IAAI,CAAC,mCAAmC,GAAG,IAAI,GAAG,EAAE,CAAC;QACrD,IAAI,CAAC,oCAAoC,GAAG,IAAI,GAAG,EAAE,CAAC;QACtD,IAAI,CAAC,6BAA6B,GAAG,KAAK,CAAC;QAC3C,IAAI,CAAC,4BAA4B,GAAG,KAAK,CAAC;IAC5C,CAAC;IAED;;OAEG;IACH,IAAW,UAAU;QACnB,OAAO,IAAI,CAAC,WAAW,CAAC;IAC1B,CAAC;IAED;;OAEG;IACH,IAAW,mBAAmB;QAC5B,OAAO,IAAI,CAAC,4BAA4B,CAAC;IAC3C,CAAC;IAED;;;OAGG;IACH,IAAW,SAAS;QAClB,OAAO,IAAI,CAAC,UAAU,CAAC;IACzB,CAAC;IAED;;;;;;;;;OASG;IACI,qBAAqB,CAAC,UAAwC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CAAC,SAAS,EAAE,GAAG,WAAW,GAAG,OAAO,CAAC,SAAS,EAAE,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;IACtG,CAAC;;AAlwBc,wCAAW,GAAW,CAAC,CAAC;AADnB,oEAA4B","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\n// See LICENSE in the project root for license information.\n\nimport * as argparse from 'argparse';\n\nimport type {\n ICommandLineChoiceDefinition,\n ICommandLineChoiceListDefinition,\n ICommandLineIntegerDefinition,\n ICommandLineIntegerListDefinition,\n ICommandLineFlagDefinition,\n ICommandLineStringDefinition,\n ICommandLineStringListDefinition,\n ICommandLineRemainderDefinition\n} from '../parameters/CommandLineDefinition';\nimport type { ICommandLineParserOptions } from './CommandLineParser';\nimport {\n type CommandLineParameter,\n type CommandLineParameterWithArgument,\n CommandLineParameterKind\n} from '../parameters/BaseClasses';\nimport { CommandLineChoiceParameter } from '../parameters/CommandLineChoiceParameter';\nimport { CommandLineChoiceListParameter } from '../parameters/CommandLineChoiceListParameter';\nimport { CommandLineIntegerParameter } from '../parameters/CommandLineIntegerParameter';\nimport { CommandLineIntegerListParameter } from '../parameters/CommandLineIntegerListParameter';\nimport { CommandLineFlagParameter } from '../parameters/CommandLineFlagParameter';\nimport { CommandLineStringParameter } from '../parameters/CommandLineStringParameter';\nimport { CommandLineStringListParameter } from '../parameters/CommandLineStringListParameter';\nimport { CommandLineRemainder } from '../parameters/CommandLineRemainder';\nimport { SCOPING_PARAMETER_GROUP } from '../Constants';\nimport { CommandLineParserExitError } from './CommandLineParserExitError';\n\n/**\n * The result containing the parsed paramter long name and scope. Returned when calling\n * {@link CommandLineParameterProvider.parseScopedLongName}.\n *\n * @public\n */\nexport interface IScopedLongNameParseResult {\n /**\n * The long name parsed from the scoped long name, e.g. \"--my-scope:my-parameter\" -\\> \"--my-parameter\"\n */\n longName: string;\n\n /**\n * The scope parsed from the scoped long name or undefined if no scope was found,\n * e.g. \"--my-scope:my-parameter\" -\\> \"my-scope\"\n */\n scope: string | undefined;\n}\n\n/**\n * An object containing the state of the\n *\n * @internal\n */\nexport interface IRegisterDefinedParametersState {\n /**\n * A set of all defined parameter names registered by parent {@link CommandLineParameterProvider}\n * objects.\n */\n parentParameterNames: Set;\n}\n\n/**\n * This is the argparse result data object\n * @internal\n */\nexport interface ICommandLineParserData {\n action: string;\n aliasAction?: string;\n aliasDocumentation?: string;\n [key: string]: any; // eslint-disable-line @typescript-eslint/no-explicit-any\n}\n\nconst SCOPE_GROUP_NAME: string = 'scope';\nconst LONG_NAME_GROUP_NAME: string = 'longName';\nconst POSSIBLY_SCOPED_LONG_NAME_REGEXP: RegExp =\n /^--((?[a-z0-9]+(-[a-z0-9]+)*):)?(?[a-z0-9]+((-[a-z0-9]+)+)?)$/;\n\n/**\n * This is the common base class for CommandLineAction and CommandLineParser\n * that provides functionality for defining command-line parameters.\n *\n * @public\n */\nexport abstract class CommandLineParameterProvider {\n private static _keyCounter: number = 0;\n\n /** @internal */\n public readonly _ambiguousParameterParserKeysByName: Map;\n /** @internal */\n protected readonly _registeredParameterParserKeysByName: Map;\n\n private readonly _parameters: CommandLineParameter[];\n private readonly _parametersByLongName: Map;\n private readonly _parametersByShortName: Map;\n private readonly _parameterGroupsByName: Map<\n string | typeof SCOPING_PARAMETER_GROUP,\n argparse.ArgumentGroup\n >;\n private _parametersHaveBeenRegistered: boolean;\n private _parametersHaveBeenProcessed: boolean;\n private _remainder: CommandLineRemainder | undefined;\n\n /** @internal */\n // Third party code should not inherit subclasses or call this constructor\n public constructor() {\n this._parameters = [];\n this._parametersByLongName = new Map();\n this._parametersByShortName = new Map();\n this._parameterGroupsByName = new Map();\n this._ambiguousParameterParserKeysByName = new Map();\n this._registeredParameterParserKeysByName = new Map();\n this._parametersHaveBeenRegistered = false;\n this._parametersHaveBeenProcessed = false;\n }\n\n /**\n * Returns a collection of the parameters that were defined for this object.\n */\n public get parameters(): ReadonlyArray {\n return this._parameters;\n }\n\n /**\n * Informs the caller if the argparse data has been processed into parameters.\n */\n public get parametersProcessed(): boolean {\n return this._parametersHaveBeenProcessed;\n }\n\n /**\n * If {@link CommandLineParameterProvider.defineCommandLineRemainder} was called,\n * this object captures any remaining command line arguments after the recognized portion.\n */\n public get remainder(): CommandLineRemainder | undefined {\n return this._remainder;\n }\n\n /**\n * Defines a command-line parameter whose value must be a string from a fixed set of\n * allowable choices (similar to an enum).\n *\n * @remarks\n * Example of a choice parameter:\n * ```\n * example-tool --log-level warn\n * ```\n */\n public defineChoiceParameter(definition: ICommandLineChoiceDefinition): CommandLineChoiceParameter {\n const parameter: CommandLineChoiceParameter = new CommandLineChoiceParameter(definition);\n this._defineParameter(parameter);\n return parameter;\n }\n\n /**\n * Returns the CommandLineChoiceParameter with the specified long name.\n * @remarks\n * This method throws an exception if the parameter is not defined.\n */\n public getChoiceParameter(parameterLongName: string, parameterScope?: string): CommandLineChoiceParameter {\n return this._getParameter(parameterLongName, CommandLineParameterKind.Choice, parameterScope);\n }\n\n /**\n * Defines a command-line parameter whose value must be a string from a fixed set of\n * allowable choices (similar to an enum). The parameter can be specified multiple times to\n * build a list.\n *\n * @remarks\n * Example of a choice list parameter:\n * ```\n * example-tool --allow-color red --allow-color green\n * ```\n */\n public defineChoiceListParameter(\n definition: ICommandLineChoiceListDefinition\n ): CommandLineChoiceListParameter {\n const parameter: CommandLineChoiceListParameter = new CommandLineChoiceListParameter(definition);\n this._defineParameter(parameter);\n return parameter;\n }\n\n /**\n * Returns the CommandLineChoiceListParameter with the specified long name.\n * @remarks\n * This method throws an exception if the parameter is not defined.\n */\n public getChoiceListParameter(\n parameterLongName: string,\n parameterScope?: string\n ): CommandLineChoiceListParameter {\n return this._getParameter(parameterLongName, CommandLineParameterKind.ChoiceList, parameterScope);\n }\n\n /**\n * Defines a command-line switch whose boolean value is true if the switch is provided,\n * and false otherwise.\n *\n * @remarks\n * Example usage of a flag parameter:\n * ```\n * example-tool --debug\n * ```\n */\n public defineFlagParameter(definition: ICommandLineFlagDefinition): CommandLineFlagParameter {\n const parameter: CommandLineFlagParameter = new CommandLineFlagParameter(definition);\n this._defineParameter(parameter);\n return parameter;\n }\n\n /**\n * Returns the CommandLineFlagParameter with the specified long name.\n * @remarks\n * This method throws an exception if the parameter is not defined.\n */\n public getFlagParameter(parameterLongName: string, parameterScope?: string): CommandLineFlagParameter {\n return this._getParameter(parameterLongName, CommandLineParameterKind.Flag, parameterScope);\n }\n\n /**\n * Defines a command-line parameter whose argument is an integer.\n *\n * @remarks\n * Example usage of an integer parameter:\n * ```\n * example-tool --max-attempts 5\n * ```\n */\n public defineIntegerParameter(definition: ICommandLineIntegerDefinition): CommandLineIntegerParameter {\n const parameter: CommandLineIntegerParameter = new CommandLineIntegerParameter(definition);\n this._defineParameter(parameter);\n return parameter;\n }\n\n /**\n * Returns the CommandLineIntegerParameter with the specified long name.\n * @remarks\n * This method throws an exception if the parameter is not defined.\n */\n public getIntegerParameter(\n parameterLongName: string,\n parameterScope?: string\n ): CommandLineIntegerParameter {\n return this._getParameter(parameterLongName, CommandLineParameterKind.Integer, parameterScope);\n }\n\n /**\n * Defines a command-line parameter whose argument is an integer. The parameter can be specified\n * multiple times to build a list.\n *\n * @remarks\n * Example usage of an integer list parameter:\n * ```\n * example-tool --avoid 4 --avoid 13\n * ```\n */\n public defineIntegerListParameter(\n definition: ICommandLineIntegerListDefinition\n ): CommandLineIntegerListParameter {\n const parameter: CommandLineIntegerListParameter = new CommandLineIntegerListParameter(definition);\n this._defineParameter(parameter);\n return parameter;\n }\n\n /**\n * Returns the CommandLineIntegerParameter with the specified long name.\n * @remarks\n * This method throws an exception if the parameter is not defined.\n */\n public getIntegerListParameter(\n parameterLongName: string,\n parameterScope?: string\n ): CommandLineIntegerListParameter {\n return this._getParameter(parameterLongName, CommandLineParameterKind.IntegerList, parameterScope);\n }\n\n /**\n * Defines a command-line parameter whose argument is a single text string.\n *\n * @remarks\n * Example usage of a string parameter:\n * ```\n * example-tool --message \"Hello, world!\"\n * ```\n */\n public defineStringParameter(definition: ICommandLineStringDefinition): CommandLineStringParameter {\n const parameter: CommandLineStringParameter = new CommandLineStringParameter(definition);\n this._defineParameter(parameter);\n return parameter;\n }\n\n /**\n * Returns the CommandLineStringParameter with the specified long name.\n * @remarks\n * This method throws an exception if the parameter is not defined.\n */\n public getStringParameter(parameterLongName: string, parameterScope?: string): CommandLineStringParameter {\n return this._getParameter(parameterLongName, CommandLineParameterKind.String, parameterScope);\n }\n\n /**\n * Defines a command-line parameter whose argument is a single text string. The parameter can be\n * specified multiple times to build a list.\n *\n * @remarks\n * Example usage of a string list parameter:\n * ```\n * example-tool --add file1.txt --add file2.txt --add file3.txt\n * ```\n */\n public defineStringListParameter(\n definition: ICommandLineStringListDefinition\n ): CommandLineStringListParameter {\n const parameter: CommandLineStringListParameter = new CommandLineStringListParameter(definition);\n this._defineParameter(parameter);\n return parameter;\n }\n\n /**\n * Defines a rule that captures any remaining command line arguments after the recognized portion.\n *\n * @remarks\n * This feature is useful for commands that pass their arguments along to an external tool, relying on\n * that tool to perform validation. (It could also be used to parse parameters without any validation\n * or documentation, but that is not recommended.)\n *\n * Example of capturing the remainder after an optional flag parameter.\n * ```\n * example-tool --my-flag this is the remainder\n * ```\n *\n * In the \"--help\" documentation, the remainder rule will be represented as \"...\".\n */\n public defineCommandLineRemainder(definition: ICommandLineRemainderDefinition): CommandLineRemainder {\n if (this._remainder) {\n throw new Error('defineRemainingArguments() has already been called for this provider');\n }\n this._remainder = new CommandLineRemainder(definition);\n return this._remainder;\n }\n\n /**\n * Returns the CommandLineStringListParameter with the specified long name.\n * @remarks\n * This method throws an exception if the parameter is not defined.\n */\n public getStringListParameter(\n parameterLongName: string,\n parameterScope?: string\n ): CommandLineStringListParameter {\n return this._getParameter(parameterLongName, CommandLineParameterKind.StringList, parameterScope);\n }\n\n /**\n * Generates the command-line help text.\n */\n public renderHelpText(): string {\n const initialState: IRegisterDefinedParametersState = {\n parentParameterNames: new Set()\n };\n this._registerDefinedParameters(initialState);\n return this._getArgumentParser().formatHelp();\n }\n\n /**\n * Generates the command-line usage text.\n */\n public renderUsageText(): string {\n const initialState: IRegisterDefinedParametersState = {\n parentParameterNames: new Set()\n };\n this._registerDefinedParameters(initialState);\n return this._getArgumentParser().formatUsage();\n }\n\n /**\n * Returns a object which maps the long name of each parameter in this.parameters\n * to the stringified form of its value. This is useful for logging telemetry, but\n * it is not the proper way of accessing parameters or their values.\n */\n public getParameterStringMap(): Record {\n const parameterMap: Record = {};\n for (const parameter of this.parameters) {\n const parameterName: string = parameter.scopedLongName || parameter.longName;\n switch (parameter.kind) {\n case CommandLineParameterKind.Flag:\n case CommandLineParameterKind.Choice:\n case CommandLineParameterKind.String:\n case CommandLineParameterKind.Integer:\n parameterMap[parameterName] = JSON.stringify(\n (\n parameter as\n | CommandLineFlagParameter\n | CommandLineIntegerParameter\n | CommandLineChoiceParameter\n | CommandLineStringParameter\n ).value\n );\n break;\n case CommandLineParameterKind.StringList:\n case CommandLineParameterKind.IntegerList:\n case CommandLineParameterKind.ChoiceList:\n const arrayValue: ReadonlyArray | undefined = (\n parameter as\n | CommandLineIntegerListParameter\n | CommandLineStringListParameter\n | CommandLineChoiceListParameter\n ).values;\n parameterMap[parameterName] = arrayValue ? arrayValue.join(',') : '';\n break;\n }\n }\n return parameterMap;\n }\n\n /**\n * Returns an object with the parsed scope (if present) and the long name of the parameter.\n */\n public parseScopedLongName(scopedLongName: string): IScopedLongNameParseResult {\n const result: RegExpExecArray | null = POSSIBLY_SCOPED_LONG_NAME_REGEXP.exec(scopedLongName);\n if (!result || !result.groups) {\n throw new Error(`The parameter long name \"${scopedLongName}\" is not valid.`);\n }\n return {\n longName: `--${result.groups[LONG_NAME_GROUP_NAME]}`,\n scope: result.groups[SCOPE_GROUP_NAME]\n };\n }\n\n /** @internal */\n public _registerDefinedParameters(state: IRegisterDefinedParametersState): void {\n if (this._parametersHaveBeenRegistered) {\n // We prevent new parameters from being defined after the first call to _registerDefinedParameters,\n // so we can already ensure that all parameters were registered.\n return;\n }\n\n // First, loop through all parameters with short names. If there are any duplicates, disable the short names\n // since we can't prefix scopes to short names in order to deduplicate them. The duplicate short names will\n // be reported as errors if the user attempts to use them.\n const parametersWithDuplicateShortNames: Set = new Set();\n for (const [shortName, shortNameParameters] of this._parametersByShortName.entries()) {\n if (shortNameParameters.length > 1) {\n for (const parameter of shortNameParameters) {\n this._defineAmbiguousParameter(shortName);\n parametersWithDuplicateShortNames.add(parameter);\n }\n }\n }\n\n // Then, loop through all parameters and register them. If there are any duplicates, ensure that they have\n // provided a scope and register them with the scope. The duplicate long names will be reported as an error\n // if the user attempts to use them.\n for (const longNameParameters of this._parametersByLongName.values()) {\n const useScopedLongName: boolean = longNameParameters.length > 1;\n for (const parameter of longNameParameters) {\n if (useScopedLongName) {\n if (!parameter.parameterScope) {\n throw new Error(\n `The parameter \"${parameter.longName}\" is defined multiple times with the same long name. ` +\n 'Parameters with the same long name must define a scope.'\n );\n }\n this._defineAmbiguousParameter(parameter.longName);\n }\n\n const ignoreShortName: boolean = parametersWithDuplicateShortNames.has(parameter);\n this._registerParameter(parameter, useScopedLongName, ignoreShortName);\n }\n }\n\n // Register the existing parameters as ambiguous parameters. These are generally provided by the\n // parent action.\n const { parentParameterNames } = state;\n for (const parentParameterName of parentParameterNames) {\n this._defineAmbiguousParameter(parentParameterName);\n }\n\n // We also need to loop through the defined ambiguous parameters and register them. These will be reported\n // as errors if the user attempts to use them.\n for (const [ambiguousParameterName, parserKey] of this._ambiguousParameterParserKeysByName) {\n // Only register the ambiguous parameter if it hasn't already been registered. We will still handle these\n // already-registered parameters as ambiguous, but by avoiding registering again, we will defer errors\n // until the user actually attempts to use the parameter.\n if (!this._registeredParameterParserKeysByName.has(ambiguousParameterName)) {\n this._registerAmbiguousParameter(ambiguousParameterName, parserKey);\n }\n }\n\n // Need to add the remainder parameter last\n if (this._remainder) {\n const argparseOptions: argparse.ArgumentOptions = {\n help: this._remainder.description,\n nargs: argparse.Const.REMAINDER,\n metavar: '\"...\"'\n };\n\n this._getArgumentParser().addArgument(argparse.Const.REMAINDER, argparseOptions);\n }\n\n this._parametersHaveBeenRegistered = true;\n }\n\n /**\n * The child class should implement this hook to define its command-line parameters,\n * e.g. by calling defineFlagParameter().\n */\n protected onDefineParameters?(): void;\n\n /**\n * Retrieves the argparse object.\n * @internal\n */\n protected abstract _getArgumentParser(): argparse.ArgumentParser;\n\n /** @internal */\n protected _processParsedData(parserOptions: ICommandLineParserOptions, data: ICommandLineParserData): void {\n if (!this._parametersHaveBeenRegistered) {\n throw new Error('Parameters have not been registered');\n }\n\n if (this._parametersHaveBeenProcessed) {\n throw new Error('Command Line Parser Data was already processed');\n }\n\n // Search for any ambiguous parameters and throw an error if any are found\n for (const [parameterName, parserKey] of this._ambiguousParameterParserKeysByName) {\n if (data[parserKey]) {\n // When the parser key matches the actually registered parameter, we know that this is an ambiguous\n // parameter sourced from the parent action or tool\n if (this._registeredParameterParserKeysByName.get(parameterName) === parserKey) {\n this._throwParserExitError(parserOptions, data, 1, `Ambiguous option: \"${parameterName}\".`);\n }\n\n // Determine if the ambiguous parameter is a short name or a long name, since the process of finding\n // the non-ambiguous name is different for each.\n const duplicateShortNameParameters: CommandLineParameter[] | undefined =\n this._parametersByShortName.get(parameterName);\n if (duplicateShortNameParameters) {\n // We also need to make sure we get the non-ambiguous long name for the parameter, since it is\n // possible for that the long name is ambiguous as well.\n const nonAmbiguousLongNames: string[] = [];\n for (const parameter of duplicateShortNameParameters) {\n const matchingLongNameParameters: CommandLineParameter[] | undefined =\n this._parametersByLongName.get(parameter.longName);\n if (!matchingLongNameParameters?.length) {\n // This should never happen\n throw new Error(\n `Unable to find long name parameters for ambiguous short name parameter \"${parameterName}\".`\n );\n }\n // If there is more than one matching long name parameter, then we know that we need to use the\n // scoped long name for the parameter. The scoped long name should always be provided.\n if (matchingLongNameParameters.length > 1) {\n if (!parameter.scopedLongName) {\n // This should never happen\n throw new Error(\n `Unable to find scoped long name for ambiguous short name parameter \"${parameterName}\".`\n );\n }\n nonAmbiguousLongNames.push(parameter.scopedLongName);\n } else {\n nonAmbiguousLongNames.push(parameter.longName);\n }\n }\n\n // Throw an error including the non-ambiguous long names for the parameters that have the ambiguous\n // short name, ex.\n // Error: Ambiguous option \"-p\" could match \"--param1\", \"--param2\"\n this._throwParserExitError(\n parserOptions,\n data,\n 1,\n `Ambiguous option: \"${parameterName}\" could match ${nonAmbiguousLongNames.join(', ')}.`\n );\n }\n\n const duplicateLongNameParameters: CommandLineParameter[] | undefined =\n this._parametersByLongName.get(parameterName);\n if (duplicateLongNameParameters) {\n const nonAmbiguousLongNames: string[] = duplicateLongNameParameters.map(\n (p: CommandLineParameter) => {\n // The scoped long name should always be provided\n if (!p.scopedLongName) {\n // This should never happen\n throw new Error(\n `Unable to find scoped long name for ambiguous long name parameter \"${parameterName}\".`\n );\n }\n return p.scopedLongName;\n }\n );\n\n // Throw an error including the non-ambiguous scoped long names for the parameters that have the\n // ambiguous long name, ex.\n // Error: Ambiguous option: \"--param\" could match --scope1:param, --scope2:param\n this._throwParserExitError(\n parserOptions,\n data,\n 1,\n `Ambiguous option: \"${parameterName}\" could match ${nonAmbiguousLongNames.join(', ')}.`\n );\n }\n\n // This shouldn't happen, but we also shouldn't allow the user to use the ambiguous parameter\n this._throwParserExitError(parserOptions, data, 1, `Ambiguous option: \"${parameterName}\".`);\n }\n }\n\n // Fill in the values for the parameters\n for (const parameter of this._parameters) {\n const value: any = data[parameter._parserKey!]; // eslint-disable-line @typescript-eslint/no-explicit-any\n parameter._setValue(value);\n }\n\n if (this.remainder) {\n this.remainder._setValue(data[argparse.Const.REMAINDER]);\n }\n\n this._parametersHaveBeenProcessed = true;\n }\n\n /** @internal */\n protected _defineParameter(parameter: CommandLineParameter): void {\n if (this._parametersHaveBeenRegistered) {\n throw new Error('Parameters have already been registered for this provider');\n }\n\n // Generate and set the parser key at definition time\n parameter._parserKey = this._generateKey();\n\n this._parameters.push(parameter);\n\n // Collect all parameters with the same long name. We will perform conflict resolution at registration.\n let longNameParameters: CommandLineParameter[] | undefined = this._parametersByLongName.get(\n parameter.longName\n );\n if (!longNameParameters) {\n longNameParameters = [];\n this._parametersByLongName.set(parameter.longName, longNameParameters);\n }\n longNameParameters.push(parameter);\n\n // Collect all parameters with the same short name. We will perform conflict resolution at registration.\n if (parameter.shortName) {\n let shortNameParameters: CommandLineParameter[] | undefined = this._parametersByShortName.get(\n parameter.shortName\n );\n if (!shortNameParameters) {\n shortNameParameters = [];\n this._parametersByShortName.set(parameter.shortName, shortNameParameters);\n }\n shortNameParameters.push(parameter);\n }\n }\n\n /** @internal */\n protected _defineAmbiguousParameter(name: string): string {\n if (this._parametersHaveBeenRegistered) {\n throw new Error('Parameters have already been registered for this provider');\n }\n\n // Only generate a new parser key if the ambiguous parameter hasn't been defined yet,\n // either as an existing parameter or as another ambiguous parameter\n let existingParserKey: string | undefined =\n this._registeredParameterParserKeysByName.get(name) ||\n this._ambiguousParameterParserKeysByName.get(name);\n if (!existingParserKey) {\n existingParserKey = this._generateKey();\n }\n\n this._ambiguousParameterParserKeysByName.set(name, existingParserKey);\n return existingParserKey;\n }\n\n /** @internal */\n protected _registerParameter(\n parameter: CommandLineParameter,\n useScopedLongName: boolean,\n ignoreShortName: boolean\n ): void {\n const names: string[] = [];\n if (parameter.shortName && !ignoreShortName) {\n names.push(parameter.shortName);\n }\n\n // Use the original long name unless otherwise requested\n if (!useScopedLongName) {\n names.push(parameter.longName);\n }\n\n // Add the scoped long name if it exists\n if (parameter.scopedLongName) {\n names.push(parameter.scopedLongName);\n }\n\n let finalDescription: string = parameter.description;\n\n const supplementaryNotes: string[] = [];\n parameter._getSupplementaryNotes(supplementaryNotes);\n if (supplementaryNotes.length > 0) {\n // If they left the period off the end of their sentence, then add one.\n if (finalDescription.match(/[a-z0-9]\"?\\s*$/i)) {\n finalDescription = finalDescription.trimRight() + '.';\n }\n // Append the supplementary text\n finalDescription += ' ' + supplementaryNotes.join(' ');\n }\n\n // NOTE: Our \"environmentVariable\" feature takes precedence over argparse's \"defaultValue\",\n // so we have to reimplement that feature.\n const argparseOptions: argparse.ArgumentOptions = {\n help: finalDescription,\n dest: parameter._parserKey,\n metavar: (parameter as CommandLineParameterWithArgument).argumentName || undefined,\n required: parameter.required\n };\n\n switch (parameter.kind) {\n case CommandLineParameterKind.Choice: {\n const choiceParameter: CommandLineChoiceParameter = parameter as CommandLineChoiceParameter;\n argparseOptions.choices = choiceParameter.alternatives as string[];\n break;\n }\n case CommandLineParameterKind.ChoiceList: {\n const choiceParameter: CommandLineChoiceListParameter = parameter as CommandLineChoiceListParameter;\n argparseOptions.choices = choiceParameter.alternatives as string[];\n argparseOptions.action = 'append';\n break;\n }\n case CommandLineParameterKind.Flag:\n argparseOptions.action = 'storeTrue';\n break;\n case CommandLineParameterKind.Integer:\n argparseOptions.type = 'int';\n break;\n case CommandLineParameterKind.IntegerList:\n argparseOptions.type = 'int';\n argparseOptions.action = 'append';\n break;\n case CommandLineParameterKind.String:\n break;\n case CommandLineParameterKind.StringList:\n argparseOptions.action = 'append';\n break;\n }\n\n let argumentGroup: argparse.ArgumentGroup | undefined;\n if (parameter.parameterGroup) {\n argumentGroup = this._parameterGroupsByName.get(parameter.parameterGroup);\n if (!argumentGroup) {\n let parameterGroupName: string;\n if (typeof parameter.parameterGroup === 'string') {\n parameterGroupName = parameter.parameterGroup;\n } else if (parameter.parameterGroup === SCOPING_PARAMETER_GROUP) {\n parameterGroupName = 'scoping';\n } else {\n throw new Error('Unexpected parameter group: ' + parameter.parameterGroup);\n }\n\n argumentGroup = this._getArgumentParser().addArgumentGroup({\n title: `Optional ${parameterGroupName} arguments`\n });\n this._parameterGroupsByName.set(parameter.parameterGroup, argumentGroup);\n }\n } else {\n argumentGroup = this._getArgumentParser();\n }\n\n argumentGroup.addArgument(names, { ...argparseOptions });\n\n if (parameter.undocumentedSynonyms?.length) {\n argumentGroup.addArgument(parameter.undocumentedSynonyms, {\n ...argparseOptions,\n help: argparse.Const.SUPPRESS\n });\n }\n\n // Register the parameter names so that we can detect ambiguous parameters\n for (const name of [...names, ...(parameter.undocumentedSynonyms || [])]) {\n this._registeredParameterParserKeysByName.set(name, parameter._parserKey!);\n }\n }\n\n protected _registerAmbiguousParameter(name: string, parserKey: string): void {\n this._getArgumentParser().addArgument(name, {\n dest: parserKey,\n // We don't know if this argument takes parameters or not, so we need to accept any number of args\n nargs: '*',\n // Ensure that the argument is not shown in the help text, since these parameters are only included\n // to inform the user that ambiguous parameters are present\n help: argparse.Const.SUPPRESS\n });\n }\n\n private _generateKey(): string {\n return 'key_' + (CommandLineParameterProvider._keyCounter++).toString();\n }\n\n private _getParameter(\n parameterLongName: string,\n expectedKind: CommandLineParameterKind,\n parameterScope?: string\n ): T {\n // Support the parameter long name being prefixed with the scope\n const { scope, longName } = this.parseScopedLongName(parameterLongName);\n parameterLongName = longName;\n parameterScope = scope || parameterScope;\n\n const parameters: CommandLineParameter[] | undefined = this._parametersByLongName.get(parameterLongName);\n if (!parameters) {\n throw new Error(`The parameter \"${parameterLongName}\" is not defined`);\n }\n\n let parameter: CommandLineParameter | undefined = parameters.find(\n (p) => p.parameterScope === parameterScope\n );\n if (!parameter) {\n if (parameterScope !== undefined) {\n throw new Error(\n `The parameter \"${parameterLongName}\" with scope \"${parameterScope}\" is not defined.`\n );\n }\n if (parameters.length !== 1) {\n throw new Error(`The parameter \"${parameterLongName}\" is ambiguous. You must specify a scope.`);\n }\n parameter = parameters[0];\n }\n\n if (parameter.kind !== expectedKind) {\n throw new Error(\n `The parameter \"${parameterLongName}\" is of type \"${CommandLineParameterKind[parameter.kind]}\"` +\n ` whereas the caller was expecting \"${CommandLineParameterKind[expectedKind]}\".`\n );\n }\n\n return parameter as T;\n }\n\n private _throwParserExitError(\n parserOptions: ICommandLineParserOptions,\n data: ICommandLineParserData,\n errorCode: number,\n message: string\n ): never {\n // Write out the usage text to make it easier for the user to find the correct parameter name\n const targetActionName: string = data.aliasAction || data.action || '';\n const errorPrefix: string =\n `Error: ${parserOptions.toolFilename}` +\n // Handle aliases, actions, and actionless parameter providers\n `${targetActionName ? ' ' : ''}${targetActionName}: error: `;\n\n // eslint-disable-next-line no-console\n console.log(this.renderUsageText());\n throw new CommandLineParserExitError(errorCode, `${errorPrefix}${message.trimStart().trimEnd()}\\n`);\n }\n}\n"]}