Joutsen.ArgumentsParsing v0.3.0+1-ga4c84ed
Public Member Functions | Properties | List of all members
Joutsen.ArgumentsParsing.SubParser< ResultType > Interface Template Reference

A sub command that can be handled by the parser. More...

Public Member Functions

void AddArgument (ParserArgument argument)
 Adds a new argument to the sub parser. More...
 
void AddArgument (string name, string alternative, ParserArgument argument)
 Adds a new argument that is identified by its name or an alternative name to the sub parser. More...
 
void AddArgument (string name, ParserArgument argument)
 Adds a new argument that is identified by its name to the sub parser. More...
 
void AddArgument (DisplayArgument argument)
 Adds a new argument that will display a message when invoked during parsing. More...
 
void AddArgument< FlagValueType > (FlagArgument< FlagValueType > argument)
 Adds a new argument that represents a flag. More...
 
void AddArgumentsGroup (ArgumentsGroup group)
 Adds a new argument group to the sub parser. More...
 
MutuallyExclusiveArgumentsGroup AddMutuallyExclusiveGroup (String name, String prefix="-", bool isRequired=false)
 A short hand method for adding a mutually exclusive arguments group. More...
 
SubParser AddSubParser (String name)
 Adds a new subparser to the sub parser. More...
 
SubParser AddSubParser (String name, String help)
 Adds a new subparser to the sub parser. More...
 
SubParser AddSubParser (String name, String destination, String help)
 Adds a new subparser to the sub parser. More...
 
SubParser< ResultType > AddSubParser< ResultType > (String name)
 Adds a new subparser to the sub parser that will create a typed result. More...
 
SubParser< ResultType > AddSubParser< ResultType > (String name, String help)
 Adds a new subparser to the sub parser that will create a typed result. More...
 
SubParser< ResultType > AddSubParser< ResultType > (String name, String destination, String help)
 Adds a new subparser to the sub parser that will create a typed result. More...
 
SubParser< ResultType > AddSubParser< TargetType, ResultType > (String name, Expression< Func< TargetType, ResultType > > destination, String help)
 Adds a new subparser to the sub parser that will create a typed result. More...
 
SubParser< ResultType > AddSubParser< ResultType > (String name, Func< ResultType > resultFactory)
 Adds a new subparser to the sub parser that will create a typed result. More...
 
SubParser< ResultType > AddSubParser< ResultType > (String name, Func< ResultType > resultFactory, String help)
 Adds a new subparser to the sub parser that will create a typed result. More...
 
SubParser< ResultType > AddSubParser< ResultType > (String name, String destination, Func< ResultType > resultFactory, String help)
 Adds a new subparser to the sub parser that will create a typed result. More...
 
SubParser< ResultType > AddSubParser< TargetType, ResultType > (String name, Expression< Func< TargetType, ResultType > > destination, Func< ResultType > resultFactory, String help)
 Adds a new subparser to the sub parser that will create a typed result. More...
 

Properties

String Name [get]
 The name that identifies the command in the input list. More...
 
Action< ParseResultResultAction [set]
 An action that will be called with the parsed result of the sub parser if assigned. More...
 
Action< ResultType > TypedResultAction [set]
 An action that will be called with the parsed result of the sub parser, if assigned. More...
 

Detailed Description

A sub command that can be handled by the parser.

A sub command that can be handled by the parser and creates and stores the parsed values in a typed target.

Since
0.2.0
Template Parameters
ResultTypethe type of the target
Since
0.2.0

Member Function Documentation

◆ AddArgument() [1/4]

void Joutsen.ArgumentsParsing.SubParser< ResultType >.AddArgument ( DisplayArgument  argument)

Adds a new argument that will display a message when invoked during parsing.

Since
0.2.0

Implemented in Joutsen.ArgumentsParsing.Parsers.DefaultSubParser< TResultType >.

◆ AddArgument() [2/4]

void Joutsen.ArgumentsParsing.SubParser< ResultType >.AddArgument ( ParserArgument  argument)

Adds a new argument to the sub parser.

Implemented in Joutsen.ArgumentsParsing.Parsers.DefaultSubParser< TResultType >.

◆ AddArgument() [3/4]

void Joutsen.ArgumentsParsing.SubParser< ResultType >.AddArgument ( string  name,
ParserArgument  argument 
)

Adds a new argument that is identified by its name to the sub parser.

Parameters
namethe name that identifies this argument in the input list
argumentthe argument

Implemented in Joutsen.ArgumentsParsing.Parsers.DefaultSubParser< TResultType >.

◆ AddArgument() [4/4]

void Joutsen.ArgumentsParsing.SubParser< ResultType >.AddArgument ( string  name,
string  alternative,
ParserArgument  argument 
)

Adds a new argument that is identified by its name or an alternative name to the sub parser.

Parameters
namethe name that identifies this argument in the input list
alternativethe alternative name that identifies this argument in the input list
argumentthe argument

Implemented in Joutsen.ArgumentsParsing.Parsers.DefaultSubParser< TResultType >.

◆ AddArgument< FlagValueType >()

void Joutsen.ArgumentsParsing.SubParser< ResultType >.AddArgument< FlagValueType > ( FlagArgument< FlagValueType >  argument)

Adds a new argument that represents a flag.

Since
0.2.0

Implemented in Joutsen.ArgumentsParsing.Parsers.DefaultSubParser< TResultType >.

◆ AddArgumentsGroup()

void Joutsen.ArgumentsParsing.SubParser< ResultType >.AddArgumentsGroup ( ArgumentsGroup  group)

Adds a new argument group to the sub parser.

Remarks
This method allows adding of custom groups of arguments to the sub parser. A custom group can be used if a different prefix is desired or arguments behave different from the existing ones.

Implemented in Joutsen.ArgumentsParsing.Parsers.DefaultSubParser< TResultType >.

◆ AddMutuallyExclusiveGroup()

MutuallyExclusiveArgumentsGroup Joutsen.ArgumentsParsing.SubParser< ResultType >.AddMutuallyExclusiveGroup ( String  name,
String  prefix = "-",
bool  isRequired = false 
)

A short hand method for adding a mutually exclusive arguments group.

Parameters
namethe name of the new group
prefixthe prefix of the named arguments in the group
isRequireddetermines if one of the arguments in the group needs to be present when parsing or if the group's arguments are optional.
Returns
an empty MutuallyExclusiveArgumentsGroup

◆ AddSubParser() [1/3]

SubParser Joutsen.ArgumentsParsing.SubParser< ResultType >.AddSubParser ( String  name)

Adds a new subparser to the sub parser.

Parameters
namethe name identifying the command this parser represents in the input string
Returns
a new empty SubParser

◆ AddSubParser() [2/3]

SubParser Joutsen.ArgumentsParsing.SubParser< ResultType >.AddSubParser ( String  name,
String  destination,
String  help 
)

Adds a new subparser to the sub parser.

Parameters
namethe name identifying the command this parser represents in the input string
destinationthe name of the key or property the parsed values will be available at after parsing
helpan additional help text that describes the command of the subparser
Returns
a new empty SubParser
Remarks
Using a destination allows the parser to store all parsed values in a single property of the target.

◆ AddSubParser() [3/3]

SubParser Joutsen.ArgumentsParsing.SubParser< ResultType >.AddSubParser ( String  name,
String  help 
)

Adds a new subparser to the sub parser.

Parameters
namethe name identifying the command this parser represents in the input string
helpan additional help text that describes the command of the subparser
Returns
a new empty SubParser

◆ AddSubParser< ResultType >() [1/6]

SubParser< ResultType > Joutsen.ArgumentsParsing.SubParser< ResultType >.AddSubParser< ResultType > ( String  name)

Adds a new subparser to the sub parser that will create a typed result.

Template Parameters
ResultTypethe type of the instance that will contain all values parsed by the subparser
Parameters
namethe name identifying the command this parser represents in the input string
Type Constraints
ResultType :new() 

◆ AddSubParser< ResultType >() [2/6]

SubParser< ResultType > Joutsen.ArgumentsParsing.SubParser< ResultType >.AddSubParser< ResultType > ( String  name,
Func< ResultType >  resultFactory 
)

Adds a new subparser to the sub parser that will create a typed result.

Template Parameters
ResultTypethe type of the instance that will contain all values parsed by the subparser
Parameters
namethe name identifying the command this parser represents in the input string

◆ AddSubParser< ResultType >() [3/6]

SubParser< ResultType > Joutsen.ArgumentsParsing.SubParser< ResultType >.AddSubParser< ResultType > ( String  name,
Func< ResultType >  resultFactory,
String  help 
)

Adds a new subparser to the sub parser that will create a typed result.

Template Parameters
ResultTypethe type of the instance that will contain all values parsed by the subparser
Parameters
namethe name identifying the command this parser represents in the input string
resultFactorya factory method to create an instance of ResultType
helpan additional help text that describes the command of the subparser
Returns
a new empty SubParser
Since
0.3.0

◆ AddSubParser< ResultType >() [4/6]

SubParser< ResultType > Joutsen.ArgumentsParsing.SubParser< ResultType >.AddSubParser< ResultType > ( String  name,
String  destination,
Func< ResultType >  resultFactory,
String  help 
)

Adds a new subparser to the sub parser that will create a typed result.

Template Parameters
ResultTypethe type of the instance that will contain all values parsed by the subparser
Parameters
namethe name identifying the command this parser represents in the input string
destinationthe name of the key or property the parsed values will be available at after parsing
resultFactorya factory method to create an instance of ResultType
helpan additional help text that describes the command of the subparser
Returns
a new empty SubParser
Remarks
Using a destination allows the parser to store all parsed values in a single property of the target.
Since
0.3.0

◆ AddSubParser< ResultType >() [5/6]

SubParser< ResultType > Joutsen.ArgumentsParsing.SubParser< ResultType >.AddSubParser< ResultType > ( String  name,
String  destination,
String  help 
)

Adds a new subparser to the sub parser that will create a typed result.

Template Parameters
ResultTypethe type of the instance that will contain all values parsed by the subparser
Parameters
namethe name identifying the command this parser represents in the input string
destinationthe name of the key or property the parsed values will be available at after parsing
helpan additional help text that describes the command of the subparser
Returns
a new empty SubParser
Remarks
Using a destination allows the parser to store all parsed values in a single property of the target.
Type Constraints
ResultType :new() 

◆ AddSubParser< ResultType >() [6/6]

SubParser< ResultType > Joutsen.ArgumentsParsing.SubParser< ResultType >.AddSubParser< ResultType > ( String  name,
String  help 
)

Adds a new subparser to the sub parser that will create a typed result.

Template Parameters
ResultTypethe type of the instance that will contain all values parsed by the subparser
Parameters
namethe name identifying the command this parser represents in the input string
helpan additional help text that describes the command of the subparser
Returns
a new empty SubParser
Type Constraints
ResultType :new() 

◆ AddSubParser< TargetType, ResultType >() [1/2]

SubParser< ResultType > Joutsen.ArgumentsParsing.SubParser< ResultType >.AddSubParser< TargetType, ResultType > ( String  name,
Expression< Func< TargetType, ResultType > >  destination,
Func< ResultType >  resultFactory,
String  help 
)

Adds a new subparser to the sub parser that will create a typed result.

Template Parameters
ResultTypethe type of the instance that will contain all values parsed by the subparser
TargetTypethe type of the instance that will be used as the target of the parse process
Parameters
namethe name identifying the command this parser represents in the input string
destinationan expression describing the target property the result is assigned to
resultFactorya factory method to create an instance of ResultType
helpan additional help text that describes the command of the subparser
Returns
a new empty SubParser
Remarks
Using a destination allows the parser to store all parsed values in a single property of the target. This is a type safe way of defining the destionation for direct property assignment.
Since
0.3.0

Implemented in Joutsen.ArgumentsParsing.Parsers.DefaultSubParser< TResultType >.

◆ AddSubParser< TargetType, ResultType >() [2/2]

SubParser< ResultType > Joutsen.ArgumentsParsing.SubParser< ResultType >.AddSubParser< TargetType, ResultType > ( String  name,
Expression< Func< TargetType, ResultType > >  destination,
String  help 
)

Adds a new subparser to the sub parser that will create a typed result.

Template Parameters
ResultTypethe type of the instance that will contain all values parsed by the subparser
TargetTypethe type of the instance that will be used as the target of the parse process
Parameters
namethe name identifying the command this parser represents in the input string
destinationan expression describing the target property the result is assigned to
helpan additional help text that describes the command of the subparser
Returns
a new empty SubParser
Remarks
Using a destination allows the parser to store all parsed values in a single property of the target. This is a type safe way of defining the destionation for direct property assignment.

Implemented in Joutsen.ArgumentsParsing.Parsers.DefaultSubParser< TResultType >.

Type Constraints
ResultType :new() 

Property Documentation

◆ Name

String Joutsen.ArgumentsParsing.SubParser< ResultType >.Name
get

The name that identifies the command in the input list.

Implemented in Joutsen.ArgumentsParsing.Parsers.DefaultSubParser< TResultType >.

◆ ResultAction

Action<ParseResult> Joutsen.ArgumentsParsing.SubParser< ResultType >.ResultAction
set

An action that will be called with the parsed result of the sub parser if assigned.

Implemented in Joutsen.ArgumentsParsing.Parsers.DefaultSubParser< TResultType >.

◆ TypedResultAction

Action<ResultType> Joutsen.ArgumentsParsing.SubParser< ResultType >.TypedResultAction
set

An action that will be called with the parsed result of the sub parser, if assigned.

Remarks
If this action is called and no destination property is specified, the parsed values will not be set on the target object but only on the created object that is parsed to this action. If the destination is set as well, the action will be called and the destination property will be filled with the result of the parser.

Implemented in Joutsen.ArgumentsParsing.Parsers.DefaultSubParser< TResultType >.