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
stringmethod
ConsoleCommand.CommandMethod
Properties
Autocomplete
See ConsoleCommand.AutocompleteMethod for details.
public ConsoleCommand.AutocompleteMethod Autocomplete { get; init; }
Property Value
Method
Method to be called when the console command is invoked.
public ConsoleCommand.CommandMethod Method { get; }
Property Value
Name
The name of this console command.
public string Name { get; }
Property Value
Validate
See ConsoleCommand.ValidateMethod for more details.
public ConsoleCommand.ValidateMethod Validate { get; init; }
Property Value
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
DefaultValidate(string[], out string?)
Default validate implementation. Everything goes.
public static bool DefaultValidate(string[] args, out string? outMessage)
Parameters
Returns
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
MethodInfoattribute
ConsoleCommandAttributeinstance
object
Returns
ValidateSingleNumeric(string[], ref string)
Validates parameters
public static bool ValidateSingleNumeric(string[] args, ref string outMessage)