in src/main/java/com/awslabs/iot/client/interfaces/AwsIotClientTerminal.java [27:57]
default void mainLoop() throws IOException {
Set<String> fullCommands = new HashSet<>();
Set<CommandHandler> commandHandlerSet = getCommandHandlerSet();
for (CommandHandler commandHandler : commandHandlerSet) {
int previousSize = fullCommands.size();
String fullCommandString = commandHandler.getFullCommandString();
fullCommands.add(fullCommandString);
if (fullCommands.size() == previousSize) {
String message = String.join("", "Duplicate command string found [", fullCommandString, "]");
write(message);
throw new UnsupportedOperationException(message);
}
}
DefaultHistory history = new DefaultHistory();
Terminal terminal = getTerminal();
LineReader reader = LineReaderBuilder.builder()
.terminal(terminal)
.completer(getCommandsCompleter())
.history(history)
.build();
Try.of(() -> infiniteInputLoop(reader))
.recover(UserInterruptException.class, this::handleUserInterruptException)
.get();
}