Create the object - maintains the definition used to validate against the input arguments.
The command definition supplied to validate the arguments against.
The full command definition - which includes the parents of the command.
The error list that is appended to the error response object.
Get an instance of the logger.
The full list of command options from the command definition
Command option short/long
If an option was specified, some other option should have been specified
Append the validator error to the response object.
Accept the input and check for a match.
: true if the value is allowable.
If the user specifies no value for an option that requires a string value, that's an error
Issue the 'file must exist' error
is the option a positional option? defaults to false
Get the 'dash form' of an option as it would appear in a user's command, appending the proper number of dashes depending on the length of the option name
e.g. my-option
Build up an object used for filling in syntax error messages with fields from an option definition
the option definition to use
is the option a positional option? defaults to false
- an object used to replace {{variables}} with mustache
"impliesOneOf" (implicationAlternatives) condition was not satisfied
Issue an error message indicating that the JSON string provided is not valid.
the JSON parse try/catch error.
The Option definition Validate the options. Includes automatic validation based on option and command definition as well as custom validation provided by the user
: True if the options are valid, false if there is a syntax error
If the option requires one of a set of values and the value provided doesn't match
the value that was specified by the user
Issue the 'option is required' error.
Issue an error message indicating the missing positional parameters
The list of missing positional parameters for the command.
If one of a set of options are required, issue an error message with the list of required options.
If the option requires one of a set of values and the value provided doesn't match
the value specified by the user which was not an array
If more than one of a set of options are specified, issue an error message with the list of offending options
Issue the options are mutually exclusive error.
Issue the options require one another (dependency) error.
Issue error message indicating that the positional parameter specified does not match the regex.
If the option was specified multiple times despite not being an array type option, that's a syntax error
If the user specifies an extra positional option
Validate the command syntax.
Validate if the option's value as array contains duplicates. If yes, error messages will be issued.
: false if the value is not valid.
Validate that the option's value is a boolean type
is the option a positional option? defaults to false
Validate that the option's value is numeric.
is the option a positional option? defaults to false
Validate the that option's value is within the range specified. If not, error messages will be issued.
is this a positional option? this method works with regular options and positionals
: false if the value is not valid.
Validate the that option's value is within the range specified. If not, error messages will be issued.
: false if the option's value is not valid.
Validate the options. Includes automatic validation based on option and command definition as well as custom validation provided by the user
: True if the options are valid
If this option's specification requires another option to be present. e.g. '--type TXT' requires that '--maxlinelength' be specified. That condition was not satisfied, so issue an error message
Generated using TypeDoc
The Imperative default syntax validator. Accepts the input arguments, command definitions, and a response object. Validates the syntax and issues the appropriate error messages if necessary.
TODO - Consider limiting to a single purpose of producing error documents TODO - that will be outputted by the command processor in a "more structured" TODO - fasion.