private void ListCommands() { var types = CommandLoader.LoadTypes().OrderBy(t => t.GetCustomAttribute <CommandLineCommandAttribute>().Command); this.IO.Writer.WriteLine(); this.IO.Writer.WriteLine(" {0}", SR.Resource("CommandLine_Commands")); this.IO.Writer.WriteLine(); var max = types.Max(t => t.GetCustomAttribute <CommandLineCommandAttribute>().Command.Length) + 10; foreach (var type in types) { var attr = type.GetCustomAttribute <CommandLineCommandAttribute>(); this.IO.Writer.Write(attr.Command.PadLeft(attr.Command.Length + 3).PadRight(max)); var descName = "CommandLine_" + attr.Description; var desc = SR.Resource(descName); if (string.Equals(descName, desc, StringComparison.OrdinalIgnoreCase)) { this.IO.Writer.WriteLine(attr.Description); } else { this.IO.Writer.WriteLine(desc); } } this.IO.Writer.WriteLine(); }
private void ListCommands() { var types = CommandLoader.LoadTypes().OrderBy(t => t.GetCustomAttribute <CommandLineCommandAttribute>().Command); this.WriteLine(); this.WriteHeader(SR.Resource("CommandLine_Commands")); this.WriteLine(); var max = types.Max(t => t.GetCustomAttribute <CommandLineCommandAttribute>().Command.Split('|').OrderByDescending(s => s.Length).First().Length) + 10; foreach (var type in types) { this.WriteCommandLabel(type, max); } }