private void ListByFlags(idCmdArgs args, CommandFlags flags)
{
string match = string.Empty;
List<CommandDefinition> cmdList = new List<CommandDefinition>();
if(args.Length > 1)
{
match = args.Get(1, -1).Replace(" ", "");
}
foreach(KeyValuePair<string, CommandDefinition> kvp in _commands)
{
if((kvp.Value.Flags & flags) == 0)
{
continue;
}
if((match.Length > 0) && (kvp.Value.Name.StartsWith(match) == false))
{
continue;
}
cmdList.Add(kvp.Value);
}
cmdList.Sort((a, b) => a.Description.CompareTo(b.Description));
foreach(CommandDefinition cmd in cmdList)
{
idConsole.WriteLine(" {0} {1}", cmd.Name.PadRight(21, ' '), cmd.Description);
}
idConsole.WriteLine("{0} commands", cmdList.Count);
}
#endregion