Show / Hide Table of Contents

Class CommandArgument

Defines an argument for a CommandDefinition

Inheritance
object
CommandArgument
Inherited Members
object.Equals(object, object)
object.GetType()
object.ReferenceEquals(object, object)
object.ToString()
Namespace: Petabridge.Cmd
Assembly: Petabridge.Cmd.Common.dll
Syntax
public sealed class CommandArgument

Constructors

CommandArgument(string, string[], string, bool, bool, bool, 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
string name

The human friendly name of the command argument.

string[] switches

The set of switches used for command on the commandline itself.

string description

Human friendly description of the commandline argument.

bool mandatory

Determines if this is a required argument or not.

bool allowMultiple

Determiens if there can be mulitple instances of this argument or not.

bool isFlag

Indicates of this argument requires a value or not. If not, then this is treated as a flag.

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
bool

DefaultValues

Optional. Represents a range of possible default values. Mostly used by tab autocompletion.

Declaration
public string[] DefaultValues { get; }
Property Value
Type Description
string[]

Description

The description for this command. Will be printed out during HELP commands.

Declaration
public string Description { get; }
Property Value
Type Description
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
bool

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
bool

Name

Human-readable property name

Declaration
public string Name { get; }
Property Value
Type Description
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
object obj
Returns
Type Description
bool
Overrides
object.Equals(object)

GetHashCode()

Declaration
public override int GetHashCode()
Returns
Type Description
int
Overrides
object.GetHashCode()
In this article
Back to top Generated by DocFX