private string FormatCommandList(IEnumerable <CommandInfo> commands) { var actualCommands = new List <CommandEntry>(); foreach (var cmd in commands) { foreach (var alias in cmd.Aliases) { actualCommands.Add(new CommandEntry(alias, cmd)); } } actualCommands.Sort(); var table = new TableWriter(3); foreach (var entry in actualCommands) { string cmdName = '`' + entry.Alias + '`'; if (string.IsNullOrWhiteSpace(entry.Command.Summary)) { table.AddRow(cmdName, "", ""); } else { table.AddRow( cmdName, " ", entry.Command.Summary ); } } return(table.Write()); }
private string FormatModuleList(IEnumerable <ModuleInfo> modules) { var table = new TableWriter(3); foreach (var mod in modules) { string modName = '`' + mod.Aliases[0] + '`'; if (string.IsNullOrWhiteSpace(mod.Summary)) { table.AddRow(modName, "", ""); } else { table.AddRow(modName, " ", mod.Summary); } } var sb = new StringBuilder(); sb.AppendLine("```"); table.Write(sb); sb.Append("```"); return(sb.ToString()); }