Class TCommandApp

Unit

Declaration

type TCommandApp = class(TCustomApplication)

Description

This class allows you to define which arguments, commands, and options will be accepted as parameters by executing the application via the command line. For that it is necessary to use the TCommandApp.CommandBuilder property.

Ex:

 
uses Command.Interfaces, Command.App, Command.Usage, Command.Version;

begin
  Application := TCommandApp.Create(nil);
  Application.Title := 'a basic cli tool sample project';

  Command.Usage.Registry(Application.CommandBuilder);
  Command.Version.Registry(Application.CommandBuilder);

  Application.Run;
  Application.Free;
end.

Hierarchy

Overview

Methods

Protected procedure DoRun; override;
Public constructor Create(TheOwner: TComponent); override;

Properties

Public property CommandBuilder: ICommandBuilder read FCommandBuilder write FCommandBuilder;

Description

Methods

Protected procedure DoRun; override;

Parse the parameters passed via the command line, validate them, execute the command informed if one was found according to the same parameters and finish the application execution.

Public constructor Create(TheOwner: TComponent); override;

Constructor of the class responsible for initializing it and its dependencies. The main dependency is the CommandBuilder.

Properties

Public property CommandBuilder: ICommandBuilder read FCommandBuilder write FCommandBuilder;

The CommandBuilder is the main property of the class, through which the commands, arguments and options that will be accepted as parameters via the command line can be configured. It is automatically launched when the application is created.


Generated by PasDoc 0.16.0.