/// <summary>Full constructor, recommended.</summary> public CommandEntry(string _commandline, int bstart, int bend, AbstractCommand _command, Argument[] _arguments, string _name, CommandPrefix _prefix, string _script, int _line, string fairtabs, Dictionary <string, Argument> nameds, ScriptEngine sys) { BlockStart = bstart; BlockEnd = bend; CommandLine = _commandline; Command = _command; Arguments = _arguments; Name = _name; Prefix = _prefix; ScriptName = _script; ScriptLine = _line; FairTabulation = fairtabs; NamedArguments = nameds; System = sys; if (Command == null) { throw new Exception("Invalid Command (null!)"); } }
/// <summary>Displays the usage information on a command to the console.</summary> /// <param name="queue">The associated queue.</param> /// <param name="entry">The CommandEntry data to show usage help to.</param> /// <param name="doError">Whether to end with an error.</param> /// <param name="cmd">The command to show help for - if unspecified, will get from the entry.</param> public static void ShowUsage(CommandQueue queue, CommandEntry entry, bool doError = true, AbstractCommand cmd = null) { if (cmd == null) { cmd = entry.Command; } if (entry.ShouldShowGood(queue)) { entry.InfoOutput(queue, TextStyle.Separate + cmd.Meta.Name + TextStyle.Base + ": " + cmd.Meta.Description); entry.InfoOutput(queue, TextStyle.Commandhelp + "Usage: /" + cmd.Meta.Name + " " + cmd.Meta.Arguments); if (cmd.Meta.IsDebug) { entry.InfoOutput(queue, "Note: This command is intended for debugging purposes."); } } if (doError) { queue.HandleError(entry, "Invalid arguments or not enough arguments!"); } }
/// <summary>Full constructor, recommended.</summary> public CommandEntry(string _commandline, int bstart, int bend, AbstractCommand _command, Argument[] _arguments, string _name, CommandPrefix _prefix, string _script, int _line, string fairtabs, ScriptEngine sys) : this(_commandline, bstart, bend, _command, _arguments, _name, _prefix, _script, _line, fairtabs, new Dictionary <string, Argument>(), sys) { }