Models a command line options.
Default constructor
public Void CommandArgs()
Command name.
public String Command { get; set; }
Whether the command line includes the -Help switch.
public Boolean Help { get; }
Whether the command line includes the -Version switch.
public Boolean Version { get; }
Whether the command line includes the -WhatIf switch.
public Boolean WhatIf { get; }
Adds a switch to the switches collection.
public Void AddSwitch(name, value)
Name | Type | Summary |
---|---|---|
name | String | Switch name. |
value | String | Switch value (optional) |
Type | Summary |
---|---|
ArgumentNullOrEmptyException | Thrown when name is null or empty. |
CommandException | Thrown when there already are a switch with the specified name. |
Gets the value of the specified switch.
public String GetSwitchValue(name)
The value of the switch, that might be null or null if the switch does not exists.
Name | Type | Summary |
---|---|---|
name | String | Switch name. |
Type | Summary |
---|---|
ArgumentNullOrEmptyException | Thrown when name is null or empty. |
Gets the value of the specified switch as an integer.
public Nullable<Int32> GetSwitchValueAsInt(name)
The value of the switch as a Nullable integer.
Name | Type | Summary |
---|---|---|
name | String | Switch name. |
Type | Summary |
---|---|
ArgumentNullOrEmptyException | Thrown when name is null or empty. |
Checks whether the specified switch exists and has a non null value.
public Boolean HasNotNullSwitch(name)
true if the switch exists and has a non null value, otherwise false.
Name | Type | Summary |
---|---|---|
name | String | Name of the switch to check. |
Type | Summary |
---|---|
ArgumentNullOrEmptyException | Thrown when name is null or empty. |
Checks whether the specified switch exists.
public Boolean HasSwitch(name)
true if the switch exists, otherwise false.
Name | Type | Summary |
---|---|---|
name | String | Name of the switch to check. |
Type | Summary |
---|---|
ArgumentNullOrEmptyException | Thrown when name is null or empty. |