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.
Afficher le fichier Open project: adamabdelhamed/PowerArgs Class Usage Examples

Méthodes publiques

Méthode 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

Méthode 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 méthode

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

CommandLineArgumentsDefinition() public méthode

Creates an empty command line arguments definition.
public CommandLineArgumentsDefinition ( ) : System
Résultat System

CommandLineArgumentsDefinition() public méthode

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
Résultat System

CreateVariableResolver() public méthode

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

FindArgumentByPosition() public méthode

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
Résultat CommandLineArgument

FindMatchingAction() public méthode

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
Résultat CommandLineAction

FindMatchingArgument() public méthode

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
Résultat CommandLineArgument

ToString() public méthode

Gets a basic string representation of the definition.
public ToString ( ) : string
Résultat string