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
NamestringThe parameter name, shown in usage and error messages.
ParameterTypeTypeThe CLR type the argument is converted to.
IsOptionalboolWhether the argument may be omitted (has a default, is nullable, or is a switch).
DefaultValueobjectThe value used when the argument is omitted.
IsRemainderboolWhether the parameter takes the rest of the text (RemainderAttribute).
FlagNamestringThe option name for flag parameters (FlagAttribute); null for positional ones.
SummarystringThe description from SummaryAttribute.
Properties
DefaultValue
The value used when the argument is omitted.
public object? DefaultValue { get; init; }
Property Value
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
FlagName
The option name for flag parameters (FlagAttribute); null for positional ones.
public string? FlagName { get; init; }
Property Value
IsCollection
Whether the parameter collects all remaining positional arguments (see ElementType).
public bool IsCollection { get; }
Property Value
IsFlag
Whether the parameter is bound from a named option.
public bool IsFlag { get; }
Property Value
IsOptional
Whether the argument may be omitted (has a default, is nullable, or is a switch).
public bool IsOptional { get; init; }
Property Value
IsRemainder
Whether the parameter takes the rest of the text (RemainderAttribute).
public bool IsRemainder { get; init; }
Property Value
IsSwitch
A boolean flag that does not take a value (--verbose).
public bool IsSwitch { get; }
Property Value
Name
The parameter name, shown in usage and error messages.
public string Name { get; init; }
Property Value
ParameterType
The CLR type the argument is converted to.
public Type ParameterType { get; init; }
Property Value
Summary
The description from SummaryAttribute.
public string? Summary { get; init; }
Property Value
Methods
ToString()
Formats the parameter for usage lines: <a>, [a], <text...>, [numbers...],
[--flag <v>], [--switch].
public override string ToString()
Returns
- string
The usage fragment.