Class ConsoleCommand

Namespace
Elegy.ConsoleSystem.Commands
Assembly
Elegy.ConsoleSystem.dll

Console command.

public class ConsoleCommand
Inheritance
ConsoleCommand
Inherited Members

Constructors

ConsoleCommand(string, CommandMethod)

Console command constructor.

public ConsoleCommand(string name, ConsoleCommand.CommandMethod method)

Parameters

name string
method ConsoleCommand.CommandMethod

Properties

Autocomplete

public ConsoleCommand.AutocompleteMethod Autocomplete { get; init; }

Property Value

ConsoleCommand.AutocompleteMethod

Method

Method to be called when the console command is invoked.

public ConsoleCommand.CommandMethod Method { get; }

Property Value

ConsoleCommand.CommandMethod

Name

The name of this console command.

public string Name { get; }

Property Value

string

Validate

See ConsoleCommand.ValidateMethod for more details.

public ConsoleCommand.ValidateMethod Validate { get; init; }

Property Value

ConsoleCommand.ValidateMethod

Methods

DefaultAutocomplete(ReadOnlySpan<char>, ref string[])

Default autocomplete implementation. Doesn't offer any suggestions.

public static bool DefaultAutocomplete(ReadOnlySpan<char> text, ref string[] outSuggestions)

Parameters

text ReadOnlySpan<char>
outSuggestions string[]

Returns

bool

DefaultValidate(string[], out string?)

Default validate implementation. Everything goes.

public static bool DefaultValidate(string[] args, out string? outMessage)

Parameters

args string[]
outMessage string

Returns

bool

FromMethod(MethodInfo, ConsoleCommandAttribute, object?)

Creates a ConsoleCommand from a provided method, whose parametres must be primitives (int, float etc.) or string. If instance is not provided, method must be static.

public static ConsoleCommand? FromMethod(MethodInfo method, ConsoleCommandAttribute attribute, object? instance = null)

Parameters

method MethodInfo
attribute ConsoleCommandAttribute
instance object

Returns

ConsoleCommand

ValidateSingleNumeric(string[], ref string)

Validates parameters

public static bool ValidateSingleNumeric(string[] args, ref string outMessage)

Parameters

args string[]
outMessage string

Returns

bool