Unit Command.Interfaces
Description
This unit contains interfaces and types used by the library to build and process commands, arguments, options, validations, themes and callback functions that leverage library customization as well as make testing it easier.
Overview
Classes, Interfaces, Objects and Records
Name | Description |
---|---|
Record TColorTheme |
Color theme structure used across the library. All fields in this record represent colors that can be defined from the color constants found in the Command.Colors unit. |
Interface IOption |
Interface representing an option that can be set as expected for a command. |
Interface ICommand |
Interface representing a command that can be registered in CommandBuilder for later use by the user. |
Interface IArgument |
Interface representing an argument that can be registered in CommandBuilder for later use by the user. |
Interface ICommandBuilder |
Interface that represents the CommandBuilder, its main purpose is to configure the arguments, commands and options accepted by the tool. Central point of the library, responsible for comparing and validating the parameters passed via the command line against the configured parameters, later executing the callback linked to the localized command. |
Interface IValidatorContext |
Interface that groups all validators, as well as establishes the validation order. |
Interface IValidatorBase |
Base interface for any validation that needs to be implemented. Specification validations need to inherit from this interface by convention from this library. It already has control for the successor validator as well as its automatic call at the appropriate time. |
Types
TCommandConstraint = (...); |
TCommandConstraints = set of TCommandConstraint; |
TOptionConstraint = (...); |
TArgumentConstraint = (...); |
TCommandCallback = procedure (ABuilder: ICommandBuilder); |
TAddCommandCallback = function (ABuilder: ICommandBuilder): Boolean; |
TOutputCallback = procedure (const AMessage: string); |
TOutputColorCallback = procedure (const AMessage: string; const AColor: byte); |
TInputLnCallback = function: string; |
Description
Types
TCommandConstraint = (...); |
Enumerated type that defines constraints that apply on commands. It is used to indicate to the CommandBuilder the rules for using the command, allowing its validation to be done automatically. Values
|
TCommandConstraints = set of TCommandConstraint; |
Set type of constraints, as they can have their combined use when configuring a command. |
TOptionConstraint = (...); |
Enumerated type that defines constraints that apply on options. It is used to indicate to the CommandBuilder the rules for using options, allowing its validation to be done automatically. Values
|
TArgumentConstraint = (...); |
Enumerated type that defines constraints that apply on arguments. It is used to indicate to the CommandBuilder the rules for using arguments, allowing its validation to be done automatically. Values
|
TCommandCallback = procedure (ABuilder: ICommandBuilder); |
Callback procedure signature that represents a command defined in the program.
Parameters
|
TAddCommandCallback = function (ABuilder: ICommandBuilder): Boolean; |
Callback function signature need to add a command using the overloaded version of CommandBuilder.AddCommand. This signature is different to avoid collision with the TCommandCallback signature. The return result is not required.
Parameters
|
TOutputCallback = procedure (const AMessage: string); |
Callback procedure signature that is intended to output text to the console, or other desired output. The library provides a standard callback that simply calls WriteLn, but it can be overridden so that the output is redirected to a file, a test function, etc.
Parameters
|
TOutputColorCallback = procedure (const AMessage: string; const AColor: byte); |
Callback procedure signature that is intended to output text to the console usings colors. The library provides a standard callback that simply calls Write before change console color, but it can be overridden so that the output is redirected to a file, a test function, etc.
Parameters
|
TInputLnCallback = function: string; |
Callback procedure signature used by the library to capture user input. A default callback is provided by the library, but it can be overridden for testing purposes primarily. Should return user input. |
Generated by PasDoc 0.16.0.