in ratis-logservice/src/main/java/org/apache/ratis/logservice/shell/LogServiceShell.java [118:149]
public static void main(String[] args) throws Exception {
final Terminal terminal = TerminalBuilder.builder()
.system(true)
.build();
History defaultHistory = new DefaultHistory();
// Register a shutdown-hook per JLine documentation to save history
Runtime.getRuntime().addShutdownHook(new Thread(() -> {
try {
defaultHistory.save();
} catch (IOException e) {
LOG.debug("Failed to save terminal history", e);
}
}));
final LineReader lineReader = LineReaderBuilder.builder()
.terminal(terminal)
.highlighter(new DefaultHighlighter())
.history(defaultHistory)
.build();
LogServiceShellOpts opts = new LogServiceShellOpts();
JCommander.newBuilder()
.addObject(opts)
.build()
.parse(args);
try (LogServiceClient logServiceClient = new LogServiceClient(opts.getMetaQuorum())) {
LogServiceShell client = new LogServiceShell(terminal, lineReader, logServiceClient);
client.run();
}
}