Unit Command.Usage
Description
This unit contains functions to display information on how to use the arguments, commands and options configured in TCommandBuilder. Its main command is the UsageCommand which is prepared to provide usage information to the user. To use this procedure, just configure it using TCommandBuilder.AddCommand method or simply call the Registry function of this unit to do that.
Overview
Functions and Procedures
procedure UsageCommand(ABuilder: ICommandBuilder); |
function GetArgumentList(ABuilder: ICommandBuilder): string; |
procedure WriteUsage(ABuilder: ICommandBuilder; const ATitle, ACommand, AOptions, AArgument: string); |
procedure WriteCommandUsage(ABuilder: ICommandBuilder); |
procedure WriteGeneralUsage(ABuilder: ICommandBuilder); |
function Registry(ABuilder: ICommandBuilder): Boolean; |
Description
Functions and Procedures
procedure UsageCommand(ABuilder: ICommandBuilder); |
Outputs text describing command usage according to commands, options and arguments configured using application command builder. If a different color theme is specified to the TCommandBuilder.ColorTheme, this command displays the usage info in different colors. If a given command needs another command as a parameter (for example help command).This command should be configured using ccNoArgumentsButCommands constraint allowing another command to be passed as parameter to UsageCommand. To use this command, just add the Command.Usage to the uses clause:
uses Command.Usage;
And call Registry procedure to add this command to the builder: Ex: Command.Usage.Registry(MyApp.CommandBuilder); or you can use the overloaded version of AddCommand to add the command to the builder using fluent interface:
MyBuilder
.AddCommand(Command.Usage.Registry);
or customize your own configuration: MyApp.CommandBuilder .AddCommand( 'help', 'Shows information about how to use this tool or about a specific command.' + #13#10 + 'Ex: ' + ABuilder.ExeName + ' help', @UsageCommand, [ccDefault, ccNoArgumentsButCommands]);
Parameters
|
function GetArgumentList(ABuilder: ICommandBuilder): string; |
Returns an argument list configured for CommandBuilder as a simple string. It will be used to display argument usage info to the user.
Parameters
|
procedure WriteUsage(ABuilder: ICommandBuilder; const ATitle, ACommand, AOptions, AArgument: string); |
Outputs simple usage command using provided parameters for the command provided. Display the usage in the following format 'EXECUTABLE [command] [options]'.
Parameters
|
procedure WriteCommandUsage(ABuilder: ICommandBuilder); |
Outputs full usage information for a specific command. It´s used when the user requests help for a specific command.
Parameters
|
procedure WriteGeneralUsage(ABuilder: ICommandBuilder); |
Outputs general help information for the application, including command usage syntax, command list, command description, arguments that are acceptable. Also displays application title and version information.
Parameters
|
function Registry(ABuilder: ICommandBuilder): Boolean; |
Configure UsageCommand with standard parameters.
Ex: Command.Usage.Registry(MyApp.CommandBuilder); Ex with fluent interface: Builder.AddCommand(Command.Usage.Registry);
Parameters
|
Generated by PasDoc 0.16.0.