import { RawObjectDataProcessor } from "@yamato-daiwa/es-extensions"; import type { ParsedJSON } from "@yamato-daiwa/es-extensions"; declare class ConsoleCommandsParser { static localization: ConsoleCommandsParser.Localization; private static readonly MINIMAL_ARGUMENTS_COUNT_IN_VALID_CONSOLE_COMMAND; private static readonly PARSING_METHOD_INVOCATION_EXPRESSION; private readonly applicationName; private readonly targetCommandPhrase; private readonly targetCommandPhraseDescription?; private readonly isTargetCommandPhraseDefault; private readonly targetCommandOptions?; private readonly targetCommandOptionsWhichHasNotBeenProcessedYet; private readonly targetCommandOptionsSpecification?; static parse(commandLineInterfaceSpecification: ConsoleCommandsParser.CommandLineInterfaceSpecification, argumentsVector?: ReadonlyArray): ConsoleCommandsParser.ParsedCommand; static generateFullHelpReference(commandLineInterfaceSpecification: ConsoleCommandsParser.CommandLineInterfaceSpecification): string; private constructor(); private parseOptionsAndParameters; private processStringTypeOptionValue; private processNumberTypeOptionValue; private extractAndValidateParsedJSON5_ParameterValue; private static isCommandArgumentTheOption; private static generateSingleCommandPhraseHelpReference; private static generateSingleCommandOptionHelpReference; private static validateCommandLineInterfaceSpecification; } declare namespace ConsoleCommandsParser { type ParsedCommand = Readonly<{ NodeJS_InterpreterAbsolutePath: string; executableFileAbsolutePath: string; phrase?: string; }> & TargetCommandsAndOptionsCombinations; type GeneralizedCommandsAndOptionsCombinations = { [name: string]: string | number | boolean | ParsedJSON; }; type CommandLineInterfaceSpecification = Readonly<{ applicationName: string; applicationDescription?: string; commandPhrases: Readonly<{ [commandPhrase: string]: CommandPhraseSpecification; }>; }>; type CommandPhraseSpecification = Readonly<{ isDefault?: boolean; description?: string; options?: CommandOptionsSpecification; }>; type CommandOptionsSpecification = Readonly<{ [optionKey: string]: OptionSpecification; }>; type OptionSpecification = Readonly<{ description?: string; shortcut?: string; newName?: string; }> & (StringOptionSpecification | NumberOptionSpecification | BooleanParameterSpecification | JSON5_ParameterSpecification); type StringOptionSpecification = Readonly<{ type: ParametersTypes.string; allowedAlternatives?: ReadonlyArray; }> & (Readonly<{ required: boolean; }> | Readonly<{ defaultValue: string; }>); type NumberOptionSpecification = Readonly<{ type: ParametersTypes.number; numbersSet: RawObjectDataProcessor.NumbersSets; minimalValue?: number; maximalValue?: number; }> & (Readonly<{ required: boolean; }> | Readonly<{ defaultValue: number; }>); type BooleanParameterSpecification = Readonly<{ type: ParametersTypes.boolean; }>; type JSON5_ParameterSpecification = Readonly<{ type: ParametersTypes.JSON5; validValueSpecification: RawObjectDataProcessor.PropertiesSpecification; }> & (Readonly<{ required: boolean; }> | Readonly<{ defaultValue: ParsedJSON; }>); enum ParametersTypes { string = "string", number = "number", boolean = "boolean", JSON5 = "JSON5" } type Localization = Readonly<{ helpReference: Localization.HelpReference; generateCheckTheCommandReferenceAsking: (commandReference: string) => string; errorsMessages: { argumentsVectorIsNotArray: Readonly<{ generate: (templateVariables: Localization.ErrorsMessages.ArgumentsVectorIsNotArray.TemplateVariables) => string; }>; argumentsVectorHasNotEnoughElements: Readonly<{ generate: (templateVariables: Localization.ErrorsMessages.RawArgumentsVectorHasNotEnoughElements.TemplateVariables) => string; }>; argumentsVectorHasNonStringElements: Readonly<{ generate: (templateVariables: Localization.ErrorsMessages.ArgumentsVectorHasNonStringElements.TemplateVariables) => string; }>; moreThanOneCommandPhrasesMarkedAsDefault: Readonly<{ generate: (templateVariables: Localization.ErrorsMessages.MoreThanOneCommandPhrasesMarkedAsDefault.TemplateVariables) => string; }>; noDefaultCommandPhraseAvailable: Readonly<{ generate: (templateVariables: Localization.ErrorsMessages.NoDefaultCommandPhraseAvailable.TemplateVariables) => string; }>; firstParameterLooksLikeCommandPhraseWhileNoCommandPhrasesAvailable: Readonly<{ generate: (templateVariables: Localization.ErrorsMessages.FirstParameterLooksLikeCommandPhraseWhileNoCommandPhrasesAvailable.TemplateVariables) => string; }>; unknownCommandPhrase: Readonly<{ generate: (templateVariables: Localization.ErrorsMessages.UnknownCommandPhrase.TemplateVariables) => string; }>; requiredOptionKeyIsMissing: Readonly<{ generate: (templateVariables: Localization.ErrorsMessages.RequiredOptionKeyIsMissing.TemplateVariables) => string; }>; noValueFollowingTheKeyOfNonBooleanOption: Readonly<{ generate: (templateVariables: Localization.ErrorsMessages.NoValueFollowingTheKeyOfNonBooleanOption.TemplateVariables) => string; }>; invalidCommandOptionTypeAtSpecification: Readonly<{ generate: (templateVariables: Localization.ErrorsMessages.InvalidCommandOptionTypeAtSpecification.TemplateVariables) => string; }>; unknownOptionsFoundForSpecificCommand: Readonly<{ generate: (templateVariables: Localization.ErrorsMessages.UnknownOptionsFoundForSpecificCommand.TemplateVariables) => string; }>; optionValueIsNotAmongAllowedAlternatives: Readonly<{ generate: (templateVariables: Localization.ErrorsMessages.OptionValueIsNotAmongAllowedAlternatives.TemplateVariables) => string; }>; unparsableNumericOptionValue: Readonly<{ generate: (templateVariables: Localization.ErrorsMessages.UnparsableNumericOptionValue.TemplateVariables) => string; }>; numericOptionValueIsNotBelongToExpectedNumbersSet: Readonly<{ generate: (templateVariables: Localization.ErrorsMessages.NumericOptionValueIsNotBelongToExpectedNumbersSet.TemplateVariables) => string; }>; numericValueIsSmallerThanRequiredMinimum: Readonly<{ generate: (templateVariables: Localization.ErrorsMessages.NumericValueIsSmallerThanRequiredMinimum.TemplateVariables) => string; }>; numericValueIsGreaterThanAllowedMaximum: Readonly<{ generate: (templateVariables: Localization.ErrorsMessages.NumericValueIsGreaterThanAllowedMaximum.TemplateVariables) => string; }>; malformedJSON5_Option: Readonly<{ generate: (templateVariables: Localization.ErrorsMessages.MalformedJSON5_Option.TemplateVariables) => string; }>; JSON5_OptionDoesNotMatchWithValidDataSchema: Readonly<{ generate: (templateVariables: Localization.ErrorsMessages.JSON5_OptionDoesNotMatchWithValidDataSchema.TemplateVariables) => string; }>; }; }>; namespace Localization { type HelpReference = Readonly<{ defaultCommandPhrase__parenthetical: string; options: string; shortcut: string; type: string; isRequired: string; defaultValue: string; yes: string; no: string; allowedAlternatives: string; numbersSet: Readonly<{ key: string; generateValue: (numbersSet: RawObjectDataProcessor.NumbersSets) => string; }>; minimalValue: string; maximalValue: string; objectTypeValuePropertiesSpecification: string; }>; namespace ErrorsMessages { namespace ArgumentsVectorIsNotArray { type TemplateVariables = Readonly<{ stringifiedActualValueOfArgumentsVector: string; }>; } namespace RawArgumentsVectorHasNotEnoughElements { type TemplateVariables = Readonly<{ minimalElementsCountInArgumentsVector: number; actualElementsCountInArgumentsVector: number; stringifiedArgumentsVector: string; }>; } namespace ArgumentsVectorHasNonStringElements { type TemplateVariables = Readonly<{ stringifiedFormattedNonStringArguments: string; }>; } namespace MoreThanOneCommandPhrasesMarkedAsDefault { type TemplateVariables = Readonly<{ formattedListOfCommandsPhrasesMarkedAsDefault: string; }>; } namespace NoDefaultCommandPhraseAvailable { type TemplateVariables = Readonly<{ helpReference: string; }>; } namespace FirstParameterLooksLikeCommandPhraseWhileNoCommandPhrasesAvailable { type TemplateVariables = Readonly<{ commandPhraseLikeArgument: string; helpReference: string; }>; } namespace UnknownCommandPhrase { type TemplateVariables = Readonly<{ inputtedCommandPhrase: string; helpReference: string; }>; } namespace UnknownOptionsFoundForSpecificCommand { type TemplateVariables = Readonly<{ commandPhrase?: string; formattedUnknownOptions: string; commandHelpReference: string; }>; } namespace InvalidCommandOptionTypeAtSpecification { type TemplateVariables = Readonly<{ optionName: string; typeName: string; }>; } namespace RequiredOptionKeyIsMissing { type TemplateVariables = Readonly<{ commandPhrase: string; isDefaultCommandPhrase: boolean; missingOptionKey: string; commandHelpReference: string; }>; } namespace NoValueFollowingTheKeyOfNonBooleanOption { type TemplateVariables = Readonly<{ targetOptionKey: string; commandHelpReference: string; }>; } namespace OptionValueIsNotAmongAllowedAlternatives { type TemplateVariables = Readonly<{ targetOptionKey: string; actualOptionValue: string; commandHelpReference: string; }>; } namespace UnparsableNumericOptionValue { type TemplateVariables = Readonly<{ targetOptionKey: string; actualOptionValue: string; commandHelpReference: string; }>; } namespace NumericOptionValueIsNotBelongToExpectedNumbersSet { type TemplateVariables = Readonly<{ targetOptionKey: string; expectedNumbersSet: RawObjectDataProcessor.NumbersSets; actualOptionValue: string; commandHelpReference: string; }>; } namespace NumericValueIsSmallerThanRequiredMinimum { type TemplateVariables = Readonly<{ targetOptionKey: string; requiredMinimum: number; actualOptionValue: string; commandHelpReference: string; }>; } namespace NumericValueIsGreaterThanAllowedMaximum { type TemplateVariables = Readonly<{ targetOptionKey: string; allowedMaximum: number; actualOptionValue: string; commandHelpReference: string; }>; } namespace MalformedJSON5_Option { type TemplateVariables = Readonly<{ targetOptionKey: string; commandHelpReference: string; }>; } namespace JSON5_OptionDoesNotMatchWithValidDataSchema { type TemplateVariables = Readonly<{ targetOptionKey: string; formattedValidationErrorsMessages: string; }>; } } } } export default ConsoleCommandsParser;