utils/node_modules/@rushstack/ts-command-line/lib/parameters/CommandLineChoiceParameter.js.map

1 line
6.3 KiB
Plaintext
Raw Normal View History

2024-02-07 01:33:07 -05:00
{"version":3,"file":"CommandLineChoiceParameter.js","sourceRoot":"","sources":["../../src/parameters/CommandLineChoiceParameter.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;AAG3D,+CAA+E;AAE/E;;;GAGG;AACH,MAAa,0BAA2B,SAAQ,kCAAoB;IAYlE,gBAAgB;IAChB,YAAmB,UAAwC;QACzD,KAAK,CAAC,UAAU,CAAC,CAAC;QAPZ,WAAM,GAAuB,SAAS,CAAC;QAS7C,IAAI,UAAU,CAAC,YAAY,CAAC,MAAM,GAAG,CAAC,EAAE;YACtC,MAAM,IAAI,KAAK,CACb,0FAA0F,CAC3F,CAAC;SACH;QACD,IAAI,UAAU,CAAC,YAAY,IAAI,UAAU,CAAC,YAAY,CAAC,OAAO,CAAC,UAAU,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC,EAAE;YAC9F,MAAM,IAAI,KAAK,CACb,gCAAgC,UAAU,CAAC,YAAY,GAAG;gBACxD,yCAAyC,UAAU,CAAC,YAAY,CAAC,QAAQ,EAAE,EAAE,CAChF,CAAC;SACH;QAED,IAAI,CAAC,YAAY,GAAG,UAAU,CAAC,YAAY,CAAC;QAC5C,IAAI,CAAC,YAAY,GAAG,UAAU,CAAC,YAAY,CAAC;QAC5C,IAAI,CAAC,oBAAoB,CAAC,CAAC,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;QAC/C,IAAI,CAAC,WAAW,GAAG,UAAU,CAAC,WAAW,CAAC;IAC5C,CAAC;IAED,8CAA8C;IAC9C,IAAW,IAAI;QACb,OAAO,sCAAwB,CAAC,MAAM,CAAC;IACzC,CAAC;IAED;;;OAGG;IACH,8DAA8D;IACvD,SAAS,CAAC,IAAS;QACxB,WAAW;QACX,IAAI,IAAI,KAAK,IAAI,IAAI,IAAI,KAAK,SAAS,EAAE;Y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MAAM,CAAC;IACrB,CAAC;IAED,mEAAmE;IAC5D,eAAe,CAAC,OAAiB;QACtC,IAAI,IAAI,CAAC,KAAK,KAAK,SAAS,EAAE;YAC5B,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;YAC5B,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;SAC1B;IACH,CAAC;CACF;AA5GD,gEA4GC","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 type { ICommandLineChoiceDefinition } from './CommandLineDefinition';\nimport { CommandLineParameter, CommandLineParameterKind } from './BaseClasses';\n\n/**\n * The data type returned by {@link CommandLineParameterProvider.defineChoiceParameter}.\n * @public\n */\nexport class CommandLineChoiceParameter extends CommandLineParameter {\n /** {@inheritDoc ICommandLineChoiceDefinition.alternatives} */\n public readonly alternatives: ReadonlyArray<string>;\n\n /** {@inheritDoc ICommandLineStringDefinition.defaultValue} */\n public readonly defaultValue: string | undefined;\n\n private _value: string | undefined = undefined;\n\n /** {@inheritDoc ICommandLineChoiceDefinition.completions} */\n public readonly completions: (() => Promise<string[]>) | undefined;\n\n /** @internal */\n public constructor(definition: ICommandLineChoiceDefinition) {\n super(definition);\n\n if (definition.alternatives.length < 1) {\n throw new Error(\n `When defining a choice parameter, the alternatives list must contain at least one value.`\n );\n }\n if (definition.defaultValue && definition.alternatives.indexOf(definition.defaultValue) === -1) {\n throw new Error(\n `The specified default value \"${definition.defaultValue}\"` +\n ` is not one of the available options: ${definition.alternatives.toString()}`\n );\n }\n\n this.alternatives = definition.alternatives;\n this.defaultValue = definition.defaultValue;\n this.validateDefaultValue(!!this.defaultValue);\n this.completions = definition.completions;\n }\n\n