jline.console.completer.CandidateListCompletionHandler Java Examples

The following examples show how to use jline.console.completer.CandidateListCompletionHandler. 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: ReplClient.java    From enkan with Eclipse Public License 1.0 6 votes vote down vote up
public void start(int initialPort) throws Exception {
    ConsoleReader console = new ConsoleReader();
    console.getTerminal().setEchoEnabled(false);
    console.setPrompt("\u001B[32menkan\u001B[0m> ");
    History history = new FileHistory(new File(System.getProperty("user.home"), ".enkan_history"));
    console.setHistory(history);

    CandidateListCompletionHandler handler = new CandidateListCompletionHandler();
    console.setCompletionHandler(handler);

    consoleHandler = new ConsoleHandler(console);
    if (initialPort > 0) {
        consoleHandler.connect(initialPort);
    }
    clientThread.execute(consoleHandler);
    clientThread.shutdown();
}
 
Example #2
Source File: MacroBaseSQLRepl.java    From macrobase with Apache License 2.0 5 votes vote down vote up
/**
 * Main entry point to the SQL CLI interface in MacroBase
 *
 * @param userWantsPaging try to enable paging of results in SQL shell
 * @throws IOException if unable to instantiate ConsoleReader
 */
private MacroBaseSQLRepl(final boolean userWantsPaging) throws IOException {
    // First try to turn paging on
    this.paging = enablePaging(userWantsPaging);
    // Initialize console reader and writer
    reader = new ConsoleReader();
    final CandidateListCompletionHandler handler = new CandidateListCompletionHandler();
    handler.setStripAnsi(true);
    reader.setCompletionHandler(handler);
    reader.addCompleter(new FileNameCompleter());

    parser = new SqlParser();
    queryEngine = new QueryEngine();
}
 
Example #3
Source File: JLineConsole.java    From es6draft with MIT License 5 votes vote down vote up
@Override
public void addCompleter(Completer completer) {
    CandidateListCompletionHandler handler = new CandidateListCompletionHandler();
    // handler.setPrintSpaceAfterFullCompletion(false);
    console.setCompletionHandler(handler);
    console.addCompleter(new JLineCompleter(completer));
}