This is an old revision of the document!
NebolIntegration supports NebolCommand and has a built-in command set ready for use.
Use like this: </code> public static Parser SetupParser() {
// get the built-in commands var commands = new Commands(engine, config);
Parser parser = new Parser();
// add the commands from the Commands class parser.Commands.AddRange(commands.CommandList);
// I'm adding an extra command, for exiting the application parser.Commands.Add(new Command { Name = "exit", AlternateName = "x", ShortDescription = "exit the application gracefully", ExecuteDelegate = new ExecuteDelegate(item => Quit()) }); return (parser);
} </code>
var parser = SetupParser(); Console.WriteLine("Ready. Type ? for help."); while (!shutdown) { Console.Write("> "); string s = Console.ReadLine(); if (string.IsNullOrEmpty(s)) Console.WriteLine("Type help to list all commands."); else parser.Parse(s); }
public static void Quit() {
shutdown = true;
Console.WriteLine("Shutting down of application has begun...");
} </code>