C# Класс 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.
Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
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.

Приватные методы

Метод Описание
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

Описание методов

Clean() публичный Метод

Resets all portions of the model that may have side effects from being run through the argument processor.
public Clean ( ) : void
Результат void

CommandLineArgumentsDefinition() публичный Метод

Creates an empty command line arguments definition.
public CommandLineArgumentsDefinition ( ) : System
Результат System

CommandLineArgumentsDefinition() публичный Метод

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
Результат System

CreateVariableResolver() публичный Метод

Gives you an object that you can use to tell if a particular argument was specified on the command line.
public CreateVariableResolver ( ) : IBooleanVariableResolver
Результат IBooleanVariableResolver

FindArgumentByPosition() публичный Метод

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
Результат CommandLineArgument

FindMatchingAction() публичный Метод

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
Результат CommandLineAction

FindMatchingArgument() публичный Метод

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
Результат CommandLineArgument

ToString() публичный Метод

Gets a basic string representation of the definition.
public ToString ( ) : string
Результат string