Class DefaultProgram
This class provides a default implementation of a program that uses the CommandsFramework. There are options for supplying the application name, version, and website. Customize these options in order to control how the list of available commands and usage information is displayed.
Implements
Inherited Members
Namespace: Benday.CommandsFramework
Assembly: Benday.CommandsFramework.dll
Syntax
public class DefaultProgram : ICommandProgram
Constructors
| Edit this page View SourceDefaultProgram(DefaultProgramOptions, Assembly)
Constructor
Declaration
public DefaultProgram(DefaultProgramOptions options, Assembly implementationAssembly)
Parameters
| Type | Name | Description |
|---|---|---|
| DefaultProgramOptions | options | Display options such as application name, version, and website |
| Assembly | implementationAssembly | Assembly that contains your command implementations |
Properties
| Edit this page View SourceImplementationAssembly
Declaration
public Assembly ImplementationAssembly { get; }
Property Value
| Type | Description |
|---|---|
| Assembly |
Options
Declaration
public ICommandProgramOptions Options { get; }
Property Value
| Type | Description |
|---|---|
| ICommandProgramOptions |
OutputProvider
Declaration
public ITextOutputProvider OutputProvider { get; }
Property Value
| Type | Description |
|---|---|
| ITextOutputProvider |
Methods
| Edit this page View SourceDisplayCommandAliases(List<CommandAliasInfo>)
Displays the aliases that supply argument values. Plain aliases are not listed here because they are already shown next to the command name they belong to.
Declaration
public virtual void DisplayCommandAliases(List<CommandAliasInfo> aliases)
Parameters
| Type | Name | Description |
|---|---|---|
| List<CommandAliasInfo> | aliases | All of the aliases for the available commands |
DisplayCommandsWithCategories(List<CommandAttribute>)
Displays the usage information for the program and all available commands displayed by category.
Declaration
public virtual void DisplayCommandsWithCategories(List<CommandAttribute> commands)
Parameters
| Type | Name | Description |
|---|---|---|
| List<CommandAttribute> | commands | List of commands |
DisplayCommandsWithoutCategories(List<CommandAttribute>)
Displays the usage information for the program and all available commands displayed alphabetically.
Declaration
public virtual void DisplayCommandsWithoutCategories(List<CommandAttribute> commands)
Parameters
| Type | Name | Description |
|---|---|---|
| List<CommandAttribute> | commands | List of commands |
DisplayUsage(CommandAttributeUtility)
Displays the usage information for the program and all available commands.
Declaration
public virtual void DisplayUsage(CommandAttributeUtility util)
Parameters
| Type | Name | Description |
|---|---|---|
| CommandAttributeUtility | util |
GetCommandDisplayName(CommandAttribute)
Gets the name to show for a command in the list of available commands. Commands that have aliases are shown as 'name (alias1, alias2)'.
Declaration
protected static string GetCommandDisplayName(CommandAttribute command)
Parameters
| Type | Name | Description |
|---|---|---|
| CommandAttribute | command | Command attribute |
Returns
| Type | Description |
|---|---|
| string | Display name for the command |
Run(string[])
Declaration
public void Run(string[] args)
Parameters
| Type | Name | Description |
|---|---|---|
| string[] | args |