CommandResolver.define

Defines a command sentence.

Description: A "sentence" consists of multiple "words". A "word" is a string of characters, each seperated by any amount of spaces.

For instance, "build all libs" contains the words ["build", "all", "libs"].

The last word within a sentence is known as the final word (CommandNodeType.finalWord), which is what defines the actual command associated with this sentence. The final word is the only word that has the userDataForFinalNode associated with it.

The rest of the words are known as partial words (CommandNodeType.partialWord) as they are only a partial part of a full sentence. (I hate all of this as well, don't worry).

So for example, if you wanted to define the command "build all libs" with some custom user data containing, for example, a description and an execute function, you could do something such as.

myResolver.define("build all libs", MyUserData("Builds all Libraries", &buildAllLibsCommand))

You can then later use CommandResolver.resolve or CommandResolver.resolveAndAdvance, using a user-provided string, to try and resolve to the final command.

class CommandResolver(UserDataT)
void
define

Parameters

commandSentence string

The sentence to define.

userDataForFinalNode UserDataT

The UserDataT to attach to the CommandNode for the sentence's final word.

Meta