Skip to main content

CommandPart

An abstract class in Root.Township, Alta.Console.

Base for an entry in the console command tree: a module or a command. Holds its name, aliases, parent module and requirements.

Constructors​

MemberWhat it is
CommandPart(Module parent, string name, string description)Creates a CommandPart from parent, name and description.

Properties​

MemberWhat it is
List<string> Aliases { get; }Names that match this part. Starts with its own name.
override string FullName { get; }The parent's name and this name joined with a dot.
Module Parent { get; private set; }The module this part belongs to, or null at the root.
int Priority { get; set; }Breaks ties between equally good matches. Higher wins.
List<RequirementAttribute> Requirements { get; }Requirement attributes that must all pass for the part to be found.

Methods​

MemberWhat it is
IEnumerable<CommandPart> GetCommandPart(string[] lower, string[] cased, int index, CommandContext context)Finds matching parts below this one for the typed words, if requirements are met.
IEnumerable<CommandSearchResult> GetCommands(string[] lower, string[] cased, int index, CommandContext context)Finds matching commands for the typed words, if requirements are met.
bool RequirementsAreMet(CommandContext context)True if every requirement passes for the context.
override string ToString()The full path with spaces, as typed in the console.
protected abstract IEnumerable<CommandPart> GetCommandPartInternal(string[] lower, string[] cased, int index, CommandContext context)Implemented by modules and commands to find matching parts.
protected abstract IEnumerable<CommandSearchResult> GetCommandsInternal(string[] lower, string[] cased, int index, CommandContext context)Implemented by modules and commands to find matching commands.

Used in​

Members of other types that take, return or hold a CommandPart: