Table of Contents

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

prefix string

The matched prefix.

name string

The command name as typed.

rawArguments string

Everything 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

IReadOnlyList<string>

Flags

Flags using the naive split (see Split(IReadOnlySet<string>?) with no switches).

public IReadOnlyDictionary<string, string?> Flags { get; }

Property Value

IReadOnlyDictionary<string, string>

Name

The command name as typed (may be an alias).

public string Name { get; }

Property Value

string

Prefix

The matched prefix, e.g. /.

public string Prefix { get; }

Property Value

string

RawArguments

Everything after the command name, trimmed.

public string RawArguments { get; }

Property Value

string

Tokens

The tokens of RawArguments.

public IReadOnlyList<CommandToken> Tokens { get; }

Property Value

IReadOnlyList<CommandToken>

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

switches IReadOnlySet<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.