Class TArgument

Unit

Declaration

type TArgument = class(TInterfacedObject, IArgument)

Description

Class that implements the IArgument interface that represents an argument that can be registered in CommandBuilder for later use by the user.

Hierarchy

Overview

Methods

Public class function New(const ADescription: string; AConstraint: TArgumentConstraint): IArgument;

Properties

Public property Description: string read GetDescription write SetDescription;
Public property Constraint: TArgumentConstraint read GetConstraint write SetConstraint;
Public property Value: string read GetValue write SetValue;

Description

Methods

Public class function New(const ADescription: string; AConstraint: TArgumentConstraint): IArgument;

Class factory recommended as first choice for class construction. Allows initialization with initial parameters.

Parameters
ADescription
Argument description that will be displayed to the user
AConstraint
Constraints check to validate correct argument usage by the user.

Properties

Public property Description: string read GetDescription write SetDescription;

Description of the argument that best describes its purpose. It can be displayed to the user when he requests help information for the application.

Public property Constraint: TArgumentConstraint read GetConstraint write SetConstraint;

Argument constraints that will be validated against the arguments provided by the user in order to guarantee that the command is being used correctly.

Public property Value: string read GetValue write SetValue;

Returns the value of an argument after parsing the parameters informed via the command line. If a given command line parameter has not been classified as a command, it will be assigned to an argument in the order of configuration.

A command callback procedure receives a parameter name ABuilder of type TCommandBuilder, using its property Arguments is possible to retrieve an argument that was passed as a parameter by the application's user.

Ex: get a filename from parameters:

procedure MyCommand(ABuilder: ICommandBuilder);
var
  LFileName: string = '';
begin
  LFileName := ABuilder.Arguments[0].Value;
end;


Generated by PasDoc 0.16.0.