Class CommandArgument
Defines an argument for a CommandDefinition
Inheritance
Inherited Members
Namespace: Petabridge.Cmd
Assembly: cs.temp.dll.dll
Syntax
public sealed class CommandArgument
Constructors
CommandArgument(String, String[], String, Boolean, Boolean, Boolean, String[])
Creates a new CommandArgument.
Declaration
public CommandArgument(string name, string[] switches, string description, bool mandatory = false, bool allowMultiple = false, bool isFlag = false, string[] defaultValues = null)
Parameters
Type | Name | Description |
---|---|---|
System.String | name | The human friendly name of the command argument. |
System.String[] | switches | The set of switches used for command on the commandline itself. |
System.String | description | Human friendly description of the commandline argument. |
System.Boolean | mandatory | Determines if this is a required argument or not. |
System.Boolean | allowMultiple | Determiens if there can be mulitple instances of this argument or not. |
System.Boolean | isFlag | Indicates of this argument requires a value or not. If not, then this is treated as a flag. |
System.String[] | defaultValues | Optional. The set of default values that can be provided to an argument. |
Properties
AllowMultiple
If true
, allows this argument to be used multiple times.
Declaration
public bool AllowMultiple { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
DefaultValues
Optional. Represents a range of possible default values. Mostly used by tab autocompletion.
Declaration
public string[] DefaultValues { get; }
Property Value
Type | Description |
---|---|
System.String[] |
Description
The description for this command. Will be printed out during HELP commands.
Declaration
public string Description { get; }
Property Value
Type | Description |
---|---|
System.String |
IsFlag
If true
, then this argument requires a value. If not, then this argument acts just like a flag.
Declaration
public bool IsFlag { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
Mandatory
If true
, then the Command who depends on this will fail if this value is not provided.
Declaration
public bool Mandatory { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
Name
Human-readable property name
Declaration
public string Name { get; }
Property Value
Type | Description |
---|---|
System.String |
Examples
address host
Switch
The switches used to identify the command on the commandline itself.
Declaration
public CommandSwitch Switch { get; }
Property Value
Type | Description |
---|---|
CommandSwitch |
Remarks
This can be null
if the command is mandatory.
Examples
-a | -A
Methods
Equals(Object)
Declaration
public override bool Equals(object obj)
Parameters
Type | Name | Description |
---|---|---|
System.Object | obj |
Returns
Type | Description |
---|---|
System.Boolean |
Overrides
GetHashCode()
Declaration
public override int GetHashCode()
Returns
Type | Description |
---|---|
System.Int32 |