(PrintStream out, PrintStream err, String... args)
| 113 | } |
| 114 | |
| 115 | @Override |
| 116 | public Executable configure(PrintStream out, PrintStream err, String... args) { |
| 117 | return () -> { |
| 118 | int longest = |
| 119 | commands.stream() |
| 120 | .filter(CliCommand::isShown) |
| 121 | .map(CliCommand::getName) |
| 122 | .max(Comparator.comparingInt(String::length)) |
| 123 | .map(String::length) |
| 124 | .orElse(0) |
| 125 | + 2; // two space padding either side |
| 126 | |
| 127 | PrintWriter outWriter = new WrappedPrintWriter(out, 72, 0); |
| 128 | outWriter.append(getName()).append("\n\n"); |
| 129 | outWriter.append(getDescription()).append("\n").append("\n"); |
| 130 | |
| 131 | int indent = Math.min(longest + 2, 25); |
| 132 | String format = " %-" + longest + "s"; |
| 133 | |
| 134 | PrintWriter indented = new WrappedPrintWriter(out, 72, indent); |
| 135 | commands.stream() |
| 136 | .filter(CliCommand::isShown) |
| 137 | .forEach(cmd -> |
| 138 | indented.format(format, cmd.getName()).append(cmd.getDescription()).append("\n")); |
| 139 | |
| 140 | outWriter.write("\nFor each command, run with `--help` for command-specific help\n"); |
| 141 | outWriter.write( |
| 142 | "\nUse the `--ext` flag before the command name to specify an additional " |
| 143 | + "classpath to use with the server (for example, to provide additional " |
| 144 | + "commands, or to provide additional driver implementations). For example:\n"); |
| 145 | outWriter.write( |
| 146 | String.format( |
| 147 | "%n java -jar selenium.jar --ext example.jar%sdir standalone --port 1234", |
| 148 | File.pathSeparator)); |
| 149 | out.println("\n"); |
| 150 | }; |
| 151 | } |
| 152 | } |
| 153 | } |
nothing calls this directly
no test coverage detected