@Override public PrintStream err() { return console.getShell().err(); }
@Override public PrintStream out() { return console.getShell().out(); }
@Override public UIProgressMonitor createProgressMonitor(UIContext context) { return new ShellUIProgressMonitor(console.getShell().out()); }
TerminalSize terminalSize = shell.getConsole().getShell().getSize();
PrintStream out = console.getShell().out(); String label = InputComponents.getLabelFor(select, false); String description = select.getDescription();
private String promptInternal(String message, boolean echo, boolean required) throws InterruptedException { PrintStream out = console.getShell().out(); // prompts should begin with a blue '?' String indicator = (required) ? "*" : "?"; String promptFlag = new TerminalString(indicator, new TerminalColor(Color.BLUE, Color.DEFAULT), new TerminalTextStyle( CharacterType.BOLD)).toString(); out.print(promptFlag + " " + message + " "); String output; if (isAcceptDefaultsEnabled()) { output = null; } else { output = readInput(out, echo); } out.println(); return output; }
@Override public Result execute(UIExecutionContext context) throws Exception { UIContext uiContext = context.getUIContext(); Shell shell = (Shell) uiContext.getProvider(); TerminalSize terminalSize = shell.getConsole().getShell().getSize(); List<String> display = new ArrayList<>(); Set<CommandInfo> commandInfos = new TreeSet<>(); for (UICommand command : commandFactory.getCommands()) { UICommandMetadata metadata = command.getMetadata(uiContext); String name = commandFactory.getCommandName(uiContext, command); boolean enabled = command.isEnabled(uiContext); commandInfos.add(new CommandInfo(metadata.getCategory().toString(), name, metadata.getDescription(), enabled)); } for (CommandInfo command : commandInfos) { display.add(command.category + " > " + new TerminalString(command.name, new TerminalColor(command.enabled ? Color.CYAN : Color.RED, Color.DEFAULT)).toString() + " - " + command.description); } UIOutput output = uiContext.getProvider().getOutput(); PrintStream out = output.out(); out.println(Parser.formatDisplayList(display.toArray(new String[display.size()]), terminalSize.getHeight(), terminalSize.getWidth())); return Results.success(); }
.create(); console.getShell().out().println("**********************************************************************"); console.getShell().out().println("* Artificer CLI"); console.getShell().out().println("* Licensed under Apache License V2.0, Copyright 2015"); console.getShell().out().println("* Locale: " + Locale.getDefault().toString().trim()); console.getShell().out().println("**********************************************************************");