-
Notifications
You must be signed in to change notification settings - Fork 0
Template Help
NebelFox edited this page Feb 19, 2022
·
2 revisions
verbox.json
{
"boxes": {
"main": {
"commands": [
{
"name": "help",
"brief": "detailed info about an executable",
"description": [
"Shows description, parameters, and examples of an executable.",
"Parameter full-name means the full 'path' from the box root to it, including its name.",
"If called without arguments - shows the 'lobby help' (help of the box itself).",
"Alternatively, a --help switch could be used for the same effect."
],
"params": "[full-name...]"
}
]
}
}
}
Program.cs
var serializer = new Serializer();
serializer.Deserialize("verbox.json");
BoxBuilder builder = serializer.Boxes["main"];
builder.SetActionsByPaths(new Dictionary<string, Action<Context>>
{
["help"] = context => context.Box.Execute($"{string.Join(' ', (object[])context["full-name"])} --help")
});
builder.Build()
.StartDialogue();
const string description = @"Shows description, parameters, and examples of an executable.
Parameter full-name means the full 'path' from the box root to it, including its name.
If called without arguments - shows the 'lobby help' (help of the box itself).
Alternatively, a --help switch could be used for the same effect.";
new BoxBuilder()
.Command(new Command("help", "detailed info about an executable")
.WithDescription(description)
.Parameters("[full-name...]")
.Action(context => context.Box.Execute($"{string.Join(' ', (object[])context["full-name"])} --help")))
.Build()
.StartDialogue();
- General:
- File Specification:
- Templates:
- Tips