List<String> display = new ArrayList<>();
Iterable<UICommand> commands = commandFactory.getCommands();
for (UICommand command : commands)
{
UICommandMetadata metadata = command.getMetadata(uiContext);
String name = commandFactory.getCommandName(uiContext, command);
boolean enabled = command.isEnabled(uiContext);
display.add(metadata.getCategory()
+ " > "
+ new TerminalString(name, new TerminalColor(enabled ? Color.CYAN : Color.RED,
Color.DEFAULT)).toString() + " - " + metadata.getDescription());
}
UIOutput output = uiContext.getProvider().getOutput();
PrintStream out = output.out();
out.println(Parser.formatDisplayList(display.toArray(new String[display.size()]),
terminalSize.getHeight(), terminalSize.getWidth()));