C# Class PowerArgs.CommandLineArgumentsDefinition

This is the root class used to define a program's command line arguments. You can start with an empty definition and programatically add arguments or you can start from a Type that you have defined and have the definition inferred from it.
Datei anzeigen Open project: adamabdelhamed/PowerArgs Class Usage Examples

Public Methods

Method Description
Clean ( ) : void

Resets all portions of the model that may have side effects from being run through the argument processor.

CommandLineArgumentsDefinition ( ) : System

Creates an empty command line arguments definition.

CommandLineArgumentsDefinition ( Type t ) : System

Creates a command line arguments definition and infers things like Arguments, Actions, etc. from the type's metadata.

CreateVariableResolver ( ) : IBooleanVariableResolver

Gives you an object that you can use to tell if a particular argument was specified on the command line.

FindArgumentByPosition ( int position, string action = null ) : CommandLineArgument

Finds the command line argument that is allowed to be specified in the given position (zero based). You can also pass an action name if you know the context of a targeted action.

FindMatchingAction ( string key, bool throwIfMoreThanOneMatch = false ) : CommandLineAction

Finds the first CommandLineAction that matches the given key

FindMatchingArgument ( string key, bool throwIfMoreThanOneMatch = false ) : CommandLineArgument

Finds the first CommandLineArgument that matches the given key.

ToString ( ) : string

Gets a basic string representation of the definition.

Private Methods

Method Description
FindCommandLineActions ( Type t ) : List
FindCommandLineArguments ( Type t ) : List
FindMatchingArgument ( string key, bool throwIfMoreThanOneMatch, IEnumerable searchSpace ) : CommandLineArgument
MakeUsageSummary ( bool htmlEncodeBrackets = false ) : string
SetPropertyValues ( object o ) : void
Validate ( PowerArgs.ArgHook context ) : void
ValidateActionAliases ( ) : void
ValidateArguments ( IEnumerable arguments ) : void

Method Details

Clean() public method

Resets all portions of the model that may have side effects from being run through the argument processor.
public Clean ( ) : void
return void

CommandLineArgumentsDefinition() public method

Creates an empty command line arguments definition.
public CommandLineArgumentsDefinition ( ) : System
return System

CommandLineArgumentsDefinition() public method

Creates a command line arguments definition and infers things like Arguments, Actions, etc. from the type's metadata.
public CommandLineArgumentsDefinition ( Type t ) : System
t System.Type The argument scaffold type used to infer the definition
return System

CreateVariableResolver() public method

Gives you an object that you can use to tell if a particular argument was specified on the command line.
public CreateVariableResolver ( ) : IBooleanVariableResolver
return IBooleanVariableResolver

FindArgumentByPosition() public method

Finds the command line argument that is allowed to be specified in the given position (zero based). You can also pass an action name if you know the context of a targeted action.
public FindArgumentByPosition ( int position, string action = null ) : CommandLineArgument
position int the position of the argument
action string optionally specify the name of an action which may also have positional arguments defined
return CommandLineArgument

FindMatchingAction() public method

Finds the first CommandLineAction that matches the given key
public FindMatchingAction ( string key, bool throwIfMoreThanOneMatch = false ) : CommandLineAction
key string The key as if it was typed in on the command line. This can also be an alias.
throwIfMoreThanOneMatch bool If set to true then this method will throw and InvalidArgDeginitionException if more than 1 match is found
return CommandLineAction

FindMatchingArgument() public method

Finds the first CommandLineArgument that matches the given key.
public FindMatchingArgument ( string key, bool throwIfMoreThanOneMatch = false ) : CommandLineArgument
key string The key as if it was typed in on the command line. This can also be an alias.
throwIfMoreThanOneMatch bool If set to true then this method will throw and InvalidArgDeginitionException if more than 1 match is found
return CommandLineArgument

ToString() public method

Gets a basic string representation of the definition.
public ToString ( ) : string
return string