org.jline.reader.LineReader.Option Java Examples
The following examples show how to use
org.jline.reader.LineReader.Option.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ShellUtils.java From rug-cli with GNU General Public License v3.0 | 5 votes |
private static void setOptions(LineReader reader) { reader.unsetOpt(Option.AUTO_MENU); reader.unsetOpt(Option.GROUP); reader.unsetOpt(Option.MENU_COMPLETE); reader.unsetOpt(Option.AUTO_GROUP); reader.setOpt(Option.CASE_INSENSITIVE); reader.setOpt(Option.AUTO_LIST); reader.setOpt(Option.LIST_AMBIGUOUS); reader.unsetOpt(Option.INSERT_TAB); }
Example #2
Source File: Client.java From batfish with Apache License 2.0 | 4 votes |
public Client(Settings settings) { _additionalBatfishOptions = new HashMap<>(); _bfq = new TreeMap<>(); _settings = settings; switch (_settings.getRunMode()) { case batch: if (_settings.getBatchCommandFile() == null) { System.err.println( "org.batfish.client: Command file not specified while running in batch mode."); System.err.printf( "Use '-%s <cmdfile>' if you want batch mode, or '-%s interactive' if you want " + "interactive mode\n", Settings.ARG_COMMAND_FILE, Settings.ARG_RUN_MODE); System.exit(1); } _logger = new BatfishLogger(_settings.getLogLevel(), false, _settings.getLogFile()); break; case interactive: System.err.println( "This is not a supported client for Batfish. Please use pybatfish following the " + "instructions in the README: https://github.com/batfish/batfish/#how-do-i-get-started"); try { _reader = LineReaderBuilder.builder() .terminal(TerminalBuilder.builder().build()) .completer(new ArgumentCompleter(new CommandCompleter(), new NullCompleter())) .build(); Path historyPath = Paths.get(System.getenv(ENV_HOME), HISTORY_FILE); historyPath.toFile().createNewFile(); _reader.setVariable(LineReader.HISTORY_FILE, historyPath.toAbsolutePath().toString()); _reader.unsetOpt(Option.INSERT_TAB); // supports completion with nothing entered @SuppressWarnings("PMD.CloseResource") // PMD does not understand things closed later. PrintWriter pWriter = new PrintWriter(_reader.getTerminal().output(), true); @SuppressWarnings("PMD.CloseResource") // PMD does not understand things closed later. OutputStream os = new WriterOutputStream(pWriter, StandardCharsets.UTF_8); @SuppressWarnings("PMD.CloseResource") // PMD does not understand things closed later. PrintStream ps = new PrintStream(os, true); _logger = new BatfishLogger(_settings.getLogLevel(), false, ps); } catch (Exception e) { System.err.printf("Could not initialize client: %s\n", e.getMessage()); e.printStackTrace(); } break; default: System.err.println("org.batfish.client: Unknown run mode."); System.exit(1); } }