A "node" is an element that looks like this:
{
"type": "root|literal|argument",
"parser": "", // only applicable if type is argument
"properties": {}, // only applicable if type is argument, defaults to empty object
"executable": true, // default if not specified is false, meaning it isn't a runnable command by itself
"children": {}, // default if not specified is {}, meaning no children
"redirect": [] // default if not specified is null, meaning no redirect
}
A redirect
is a path to another node in the tree. ["foo", "bar", "baz"]
means "find the child named foo
of the root, then the child of that named bar
, then the child of that named baz
".
Every element of children
is another node, which itself may have more children.
A literal
type means "I expect the literal name of this node", and has no properties
.
An argument
type means it's dynamically parsed, using parser
(and any optional properties
)
Wishlist:
Regex argument parser with regex as property?
String argument with quoted property, allows spaces in strings with arguments after?
Ability for server to say not only what tab completes are available, but which tree branch is active? For disambiguation of seemingly identical arguments to the client?
Ability for greedy string to override usage text? E.g. as a server side fallback?