Class ParsedCommand
- Namespace
- Signal.Application.Commands.Parsing
- Assembly
- Signal.Application.dll
A command invocation such as /remind --in 00:10:00 "buy milk".
public sealed class ParsedCommand
- Inheritance
-
ParsedCommand
- Inherited Members
Constructors
ParsedCommand(string, string, string)
Creates a parsed command and tokenizes rawArguments.
public ParsedCommand(string prefix, string name, string rawArguments)
Parameters
prefixstringThe matched prefix.
namestringThe command name as typed.
rawArgumentsstringEverything after the name, trimmed.
Properties
Arguments
Positional arguments using the naive split (see Split(IReadOnlySet<string>?) with no switches).
public IReadOnlyList<string> Arguments { get; }
Property Value
Flags
Flags using the naive split (see Split(IReadOnlySet<string>?) with no switches).
public IReadOnlyDictionary<string, string?> Flags { get; }
Property Value
Name
The command name as typed (may be an alias).
public string Name { get; }
Property Value
Prefix
The matched prefix, e.g. /.
public string Prefix { get; }
Property Value
RawArguments
Everything after the command name, trimmed.
public string RawArguments { get; }
Property Value
Tokens
The tokens of RawArguments.
public IReadOnlyList<CommandToken> Tokens { get; }
Property Value
Methods
Split(IReadOnlySet<string>?)
Splits tokens into positional arguments and flags. A flag consumes the following token as its value
unless it is listed in switches, uses --name=value, or is followed by another flag.
A bare -- ends flag parsing; later tokens are positional even if they start with --.
public CommandArguments Split(IReadOnlySet<string>? switches)
Parameters
switchesIReadOnlySet<string>Flag names that never take a value (boolean flags), or null.
Returns
- CommandArguments
The split arguments.
ToString()
Formats the invocation, e.g. /add 1 2.
public override string ToString()
Returns
- string
The prefix, name and raw arguments.