public void ShowCommandHelp(Command command, List <CommandAction> availableActions) { var maximumActionNameLength = availableActions.Count() > 0 ? availableActions.Max(c => c.Name.Length) : 0; var actionTable = new ConsoleTable().AddRow( new ConsoleCell(String.Format("The available actions for command '{0}' are:", command.Name)).WithPadding(0)); int maximumPrototypeLength = 0; foreach (var action in availableActions) { if (action.Parameters.Count > 0) { var prototypeLength = action.Parameters .Max(c => c.GetOptionPrototypeHelp().Length); if (prototypeLength > maximumPrototypeLength) { maximumPrototypeLength = prototypeLength; } } } foreach (var action in availableActions) { actionTable.AddRow( new ConsoleCell(action.Name).WithWidth(maximumActionNameLength), new ConsoleCell(action.Description)); if (action.Parameters.Count > 0) { foreach (var p in action.Parameters) { actionTable.AddRow(new ConsoleCell(p.GetOptionPrototypeHelp()). WithWidth(maximumPrototypeLength).WithPadding(6), new ConsoleCell(p.Description)); } } if (availableActions.Last() != action) { actionTable.AddEmptyRow(); } } new ConsoleFormatter(ConsoleWriter.Default).Write(actionTable); }