Table of Contents

Class Command

Namespace
OneImlx.Terminal.Commands
Assembly
OneImlx.Terminal.dll

An immutable command. A command is a specific action or a set of actions that a user or an application requests the underlying system to perform. It can be a simple action such as invoking a system method or an OS command or representing a complex operation that calls a set of protected APIs over the internal or external network. A command can virtually do anything in the context of your application or service.

public sealed class Command
Inheritance
Command
Inherited Members

Constructors

Command(CommandDescriptor, Arguments?, Options?)

Initializes a new instance.

public Command(CommandDescriptor commandDescriptor, Arguments? arguments = null, Options? options = null)

Parameters

commandDescriptor CommandDescriptor

The command descriptor.

arguments Arguments

The command arguments.

options Options

The command options.

Properties

Arguments

The command arguments.

public Arguments? Arguments { get; set; }

Property Value

Arguments

CustomProperties

The command custom properties.

public Dictionary<string, object>? CustomProperties { get; }

Property Value

Dictionary<string, object>

Description

The command description.

public string? Description { get; }

Property Value

string

Descriptor

The command descriptor.

public CommandDescriptor Descriptor { get; }

Property Value

CommandDescriptor

Id

The command id unique.

public string Id { get; }

Property Value

string

Name

The command name.

public string Name { get; }

Property Value

string

Options

The command options.

public Options? Options { get; set; }

Property Value

Options

Methods

GetRequiredOptionValue<TValue>(string)

Get the option value for the specified identifier.

public TValue GetRequiredOptionValue<TValue>(string idOrAlias)

Parameters

idOrAlias string

The option id or its alias.

Returns

TValue

The option value.

Type Parameters

TValue

The type of value.

Exceptions

TerminalException

If the option is not supported.

TryGetArgument(string, out Argument?)

Attempts to get the argument for the specified identifier.

public bool TryGetArgument(string id, out Argument? argument)

Parameters

id string

The argument identifier.

argument Argument

The argument if found.

Returns

bool

true if the argument is found.

TryGetArgumentValue<TValue>(string, out TValue?)

Attempts to get the argument value for the specified index.

public bool TryGetArgumentValue<TValue>(string id, out TValue? value)

Parameters

id string

The argument identifier.

value TValue

The argument value.

Returns

bool

The option value.

Type Parameters

TValue

The type of value.

Exceptions

TerminalException

If the argument is not supported.

TryGetOption(string, out Option?)

Attempts to get the option for the specified identifier.

public bool TryGetOption(string idOrAlias, out Option? option)

Parameters

idOrAlias string

The option identifier or its alias.

option Option

The option if found.

Returns

bool

true if the option is found.

TryGetOptionValue<TValue>(string, out TValue?)

Attempts to get the option value for the specified identifier.

public bool TryGetOptionValue<TValue>(string idOrAlias, out TValue? value)

Parameters

idOrAlias string

The option id or its alias.

value TValue

The option value.

Returns

bool

The option value.

Type Parameters

TValue

The type of value.

Exceptions

TerminalException

If the option is not supported.

See Also