Class TCommand
Unit
Declaration
type TCommand = class(TInterfacedObject, ICommand)
Description
Class that implements the ICommand interface that represents a command that can be registered in CommandBuilder for later use by the user.
Hierarchy
- TInterfacedObject
- TCommand
Overview
Methods
| Public | constructor Create; |
| Public | function HasOptions: Boolean; |
| Public | function AddOption(const AFlag, AName, ADescription: string; ANotAllowedFlags: TArray<string> = nil; AConstraint: TOptionConstraint = ocNoValue): IOption; |
| Public | class function New(const AName, ADescription: string; ACallback: TCommandCallback; AConstraints: TCommandConstraints): ICommand; |
Properties
| Public | property Name: string read GetName write SetName; |
| Public | property Description: string read GetDescription write SetDescription; |
| Public | property Callback: TCommandCallback read GetCallback write SetCallback; |
| Public | property Constraints: TCommandConstraints read GetConstraints write SetConstraints; |
| Public | property Option[const AIndex: string]: IOption read GetOption; |
| Public | property Options: TArray<IOption> read GetOptions; |
Description
Methods
| Public | constructor Create; |
|
Basic class constructor. Use TCommand.New class factory as first option. | |
| Public | function HasOptions: Boolean; |
|
Function that returns true if the command has at least one option configured. | |
| Public | function AddOption(const AFlag, AName, ADescription: string; ANotAllowedFlags: TArray<string> = nil; AConstraint: TOptionConstraint = ocNoValue): IOption; |
|
Creates and adds the option to the command's list of options as given parameters.
Parameters
| |
| Public | class function New(const AName, ADescription: string; ACallback: TCommandCallback; AConstraints: TCommandConstraints): ICommand; |
|
Class factory recommended as first choice for class construction. Allows initialization with initial parameters.
Parameters
| |
Properties
| Public | property Name: string read GetName write SetName; |
|
Name of the command that will be used via the command line by the user. | |
| Public | property Description: string read GetDescription write SetDescription; |
|
Description of the command that best describes its purpose. It can be displayed to the user when he requests help information for the application. | |
| Public | property Callback: TCommandCallback read GetCallback write SetCallback; |
|
Procedure that will be invoked by the builder after validation of the arguments provided by the user and the correct match of this command as the requested one. | |
| Public | property Constraints: TCommandConstraints read GetConstraints write SetConstraints; |
|
Command constrains that will be validated against the arguments provided by the user in order to guarantee that the command is being used correctly. | |
| Public | property Option[const AIndex: string]: IOption read GetOption; |
|
Retrieves an option given the index provided as a parameter.
Parameters
| |
| Public | property Options: TArray<IOption> read GetOptions; |
|
Property that returns the array of options defined for the command. | |
Generated by PasDoc 1.0.4.