Table of Contents

Class CommandParameter

Namespace
Signal.Application.Commands
Assembly
Signal.Application.dll

A bindable parameter of a command.

public sealed record CommandParameter : IEquatable<CommandParameter>
Inheritance
CommandParameter
Implements
Inherited Members

Constructors

CommandParameter(string, Type, bool, object?, bool, string?, string?)

A bindable parameter of a command.

public CommandParameter(string Name, Type ParameterType, bool IsOptional, object? DefaultValue, bool IsRemainder, string? FlagName, string? Summary)

Parameters

Name string

The parameter name, shown in usage and error messages.

ParameterType Type

The CLR type the argument is converted to.

IsOptional bool

Whether the argument may be omitted (has a default, is nullable, or is a switch).

DefaultValue object

The value used when the argument is omitted.

IsRemainder bool

Whether the parameter takes the rest of the text (RemainderAttribute).

FlagName string

The option name for flag parameters (FlagAttribute); null for positional ones.

Summary string

The description from SummaryAttribute.

Properties

DefaultValue

The value used when the argument is omitted.

public object? DefaultValue { get; init; }

Property Value

object

ElementType

For collection parameters (params T[], T[], List<T>, IReadOnlyList<T>, …): the element type each remaining argument is converted to. null for single-value parameters.

public Type? ElementType { get; init; }

Property Value

Type

FlagName

The option name for flag parameters (FlagAttribute); null for positional ones.

public string? FlagName { get; init; }

Property Value

string

IsCollection

Whether the parameter collects all remaining positional arguments (see ElementType).

public bool IsCollection { get; }

Property Value

bool

IsFlag

Whether the parameter is bound from a named option.

public bool IsFlag { get; }

Property Value

bool

IsOptional

Whether the argument may be omitted (has a default, is nullable, or is a switch).

public bool IsOptional { get; init; }

Property Value

bool

IsRemainder

Whether the parameter takes the rest of the text (RemainderAttribute).

public bool IsRemainder { get; init; }

Property Value

bool

IsSwitch

A boolean flag that does not take a value (--verbose).

public bool IsSwitch { get; }

Property Value

bool

Name

The parameter name, shown in usage and error messages.

public string Name { get; init; }

Property Value

string

ParameterType

The CLR type the argument is converted to.

public Type ParameterType { get; init; }

Property Value

Type

Summary

The description from SummaryAttribute.

public string? Summary { get; init; }

Property Value

string

Methods

ToString()

Formats the parameter for usage lines: <a>, [a], <text...>, [numbers...], [--flag <v>], [--switch].

public override string ToString()

Returns

string

The usage fragment.