public Command(string name, string keyword = null, Aliases aliases = null, string description = null, Command parent = null) : base(parent) { this.Name = name ?? throw new ArgumentNullException(nameof(name)); this.Keyword = keyword?.Replace(" ", "_") ?? name.ToLower().Replace(" ", "_"); this.Description = description ?? string.Empty; this.Aliases = aliases ?? Aliases.Create(); ValidateBranch(); }
public Command RegisterHelp(string name, string keyword, string description, params string[] aliases) { Command help = new Command(name, keyword, Aliases.Create(aliases), description); help.Parameters.Add(new ParamDef("page", 0, typeof(int), "The help page to display.")); help.Parameters.Add(new ParamDef("ipp", 8, typeof(int), "The number of items per page.")); help.OnExecuted += (data) => { int page = data.Parameters.Get <int>("page"); int ipp = data.Parameters.Get <int>("ipp"); PrintCommandList(page, ipp); }; Register(help); return(help); }