CommandArgs

Models a command line options.

Namespace:
Inetdev.CLI
Type:
Class
Public:
Yes
Protected:
No
Sealed:
No
Abstract:
No
Inherits from:
System.Object

Constructors

CommandArgs

Default constructor

Signature:
public Void CommandArgs()

Properties

Command

Command name.

Signature:
public String Command { get; set; }

Help

Whether the command line includes the -Help switch.

Signature:
public Boolean Help { get; }

Version

Whether the command line includes the -Version switch.

Signature:
public Boolean Version { get; }

WhatIf

Whether the command line includes the -WhatIf switch.

Signature:
public Boolean WhatIf { get; }

Methods

AddSwitch

Adds a switch to the switches collection.

Signature:
public Void AddSwitch(name, value)
Parameters
Name Type Summary
name String Switch name.
value String Switch value (optional)
Exceptions
Type Summary
ArgumentNullOrEmptyException Thrown when name is null or empty.
CommandException Thrown when there already are a switch with the specified name.

GetSwitchValue

Gets the value of the specified switch.

Signature:
public String GetSwitchValue(name)
Returns

The value of the switch, that might be null or null if the switch does not exists.

Parameters
Name Type Summary
name String Switch name.
Exceptions
Type Summary
ArgumentNullOrEmptyException Thrown when name is null or empty.

GetSwitchValueAsInt

Gets the value of the specified switch as an integer.

Signature:
public Nullable<Int32> GetSwitchValueAsInt(name)
Returns

The value of the switch as a Nullable integer.

Parameters
Name Type Summary
name String Switch name.
Exceptions
Type Summary
ArgumentNullOrEmptyException Thrown when name is null or empty.

HasNotNullSwitch

Checks whether the specified switch exists and has a non null value.

Signature:
public Boolean HasNotNullSwitch(name)
Returns

true if the switch exists and has a non null value, otherwise false.

Parameters
Name Type Summary
name String Name of the switch to check.
Exceptions
Type Summary
ArgumentNullOrEmptyException Thrown when name is null or empty.

HasSwitch

Checks whether the specified switch exists.

Signature:
public Boolean HasSwitch(name)
Returns

true if the switch exists, otherwise false.

Parameters
Name Type Summary
name String Name of the switch to check.
Exceptions
Type Summary
ArgumentNullOrEmptyException Thrown when name is null or empty.