C# Class PowerArgs.CommandLineAction

A class that represents command line actions that users can specify on the command line. This is useful for programs like git where users first specify an action like 'push' and then the remaining arguments are either global or specific to 'push'.
Mostra file Open project: adamabdelhamed/PowerArgs Class Usage Examples

Private Properties

Property Type Description
CommandLineAction System
Create CommandLineAction
Create CommandLineAction
IsActionImplementation bool
IsActionImplementation bool
IsMatch bool
MakeUsageSummary string
PopulateArguments object

Public Methods

Method Description
CommandLineAction ( Action actionHandler ) : System

Creates a new command line action given an implementation.

Equals ( object obj ) : bool

Determines if 2 actions are the same based on their source.

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

Finds the first CommandLineArgument that matches the given key.

ToString ( ) : string

Gets a string representation of this action.

Private Methods

Method Description
CommandLineAction ( ) : System
Create ( MethodInfo actionMethod, List knownAliases ) : CommandLineAction
Create ( PropertyInfo actionProperty, List knownAliases ) : CommandLineAction
IsActionImplementation ( MethodInfo method ) : bool
IsActionImplementation ( PropertyInfo property ) : bool
IsMatch ( string actionString ) : bool
MakeUsageSummary ( bool htmlEncodeBrackets = false ) : string
PopulateArguments ( object parent, object &parameters ) : object

Method Details

CommandLineAction() public method

Creates a new command line action given an implementation.
public CommandLineAction ( Action actionHandler ) : System
actionHandler Action The implementation of the action.
return System

Equals() public method

Determines if 2 actions are the same based on their source.
public Equals ( object obj ) : bool
obj object The other action
return bool

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 string representation of this action.
public ToString ( ) : string
return string