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
![]() |
constructor Create; |
![]() |
function HasOptions: Boolean; |
![]() |
function AddOption(const AFlag, AName, ADescription: string; ANotAllowedFlags: TArray<string> = nil; AConstraint: TOptionConstraint = ocNoValue): IOption; |
![]() |
class function New(const AName, ADescription: string; ACallback: TCommandCallback; AConstraints: TCommandConstraints): ICommand; |
Properties
![]() |
property Name: string read GetName write SetName; |
![]() |
property Description: string read GetDescription write SetDescription; |
![]() |
property Callback: TCommandCallback read GetCallback write SetCallback; |
![]() |
property Constraints: TCommandConstraints read GetConstraints write SetConstraints; |
![]() |
property Option[constAIndex:string]: IOption read GetOption; |
![]() |
property Options: TArray<IOption> read GetOptions; |
Description
Methods
![]() |
constructor Create; |
Basic class constructor. Use TCommand.New class factory as first option. |
![]() |
function HasOptions: Boolean; |
Function that returns true if the command has at least one option configured. |
![]() |
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
|
![]() |
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
![]() |
property Name: string read GetName write SetName; |
Name of the command that will be used via the command line by the user. |
![]() |
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. |
![]() |
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. |
![]() |
property Option[constAIndex:string]: IOption read GetOption; |
Retrieves an option given the index provided as a parameter.
Parameters
|
![]() |
property Options: TArray<IOption> read GetOptions; |
Property that returns the array of options defined for the command. |
Generated by PasDoc 0.16.0.