本文整理汇总了Java中jline.console.completer.CandidateListCompletionHandler类的典型用法代码示例。如果您正苦于以下问题:Java CandidateListCompletionHandler类的具体用法?Java CandidateListCompletionHandler怎么用?Java CandidateListCompletionHandler使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
CandidateListCompletionHandler类属于jline.console.completer包,在下文中一共展示了CandidateListCompletionHandler类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: printCompletionCandidates
import jline.console.completer.CandidateListCompletionHandler; //导入依赖的package包/类
protected void printCompletionCandidates() throws IOException {
// debug ("tab for (" + buf + ")");
if (completers.size() == 0) {
return;
}
List<CharSequence> candidates = new LinkedList<CharSequence>();
String bufstr = buf.buffer.toString();
int cursor = buf.cursor;
for (Completer comp : completers) {
if (comp.complete(bufstr, cursor, candidates) != -1) {
break;
}
}
CandidateListCompletionHandler.printCandidates(this, candidates);
drawLine();
}
开发者ID:AcademicTorrents,项目名称:AcademicTorrents-Downloader,代码行数:19,代码来源:ConsoleReader.java
示例2: listen
import jline.console.completer.CandidateListCompletionHandler; //导入依赖的package包/类
/**
* コンソールからの入力のリスン
*
* @throws IOException I/O例外
*/
private void listen() throws IOException {
console.setPrompt("uroborosql > ");
console.setHandleUserInterrupt(true);
// コマンドのコード補完
console.addCompleter((buffer, cursor, candidates) -> {
String buff = buffer.trim();
if (buff.length() > 0 && !buffer.endsWith(" ") || buff.isEmpty()) {
Stream.of(Command.values()).filter(c -> c.match(buff)).map(Object::toString).forEach(candidates::add);
}
return candidates.isEmpty() ? -1 : 0;
});
// SQL名のコード補完
console.addCompleter(new SqlNameCompleter(config.getSqlManager().getSqlPathList()));
// バインドパラメータのコード補完
console.addCompleter(new BindParamCompleter());
// テーブル名のコード補完
console.addCompleter(new TableNameCompleter());
// SQLキーワードのコード補完
console.addCompleter(new SqlKeywordCompleter());
CandidateListCompletionHandler handler = new CandidateListCompletionHandler();
handler.setPrintSpaceAfterFullCompletion(false);
console.setCompletionHandler(handler);
while (true) { // ユーザの一行入力を待つ
try {
String line = console.readLine();
if (!commandExecute(line)) {
break;
}
} catch (UserInterruptException uie) {
break;
} catch (Exception e) {
e.printStackTrace(System.err);
}
}
}
开发者ID:future-architect,项目名称:uroborosql,代码行数:43,代码来源:SqlREPL.java
示例3: start
import jline.console.completer.CandidateListCompletionHandler; //导入依赖的package包/类
public void start() throws Exception {
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);
clientThread.execute(consoleHandler);
clientThread.shutdown();
}
开发者ID:kawasima,项目名称:enkan,代码行数:14,代码来源:ReplClient.java
示例4: initializeConsoleReader
import jline.console.completer.CandidateListCompletionHandler; //导入依赖的package包/类
private void initializeConsoleReader() {
this.consoleReader.setHistoryEnabled(true);
this.consoleReader.setBellEnabled(false);
this.consoleReader.setExpandEvents(false);
this.consoleReader.addCompleter(new CommandCompleter(this.consoleReader,
this.argumentDelimiter, this.commandRunner));
this.consoleReader.setCompletionHandler(new CandidateListCompletionHandler());
}
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:9,代码来源:Shell.java
示例5: readLine
import jline.console.completer.CandidateListCompletionHandler; //导入依赖的package包/类
private static String readLine(ConsoleReader console) throws IOException {
ConsoleUtils.begin(31);
ConsoleUtils.println(">>>");
ConsoleUtils.end();
List<Completer> completors = new LinkedList<Completer>();
// completors.add(new AnsiStringsCompleter("\u001B[1mfoo\u001B[0m",
// "bar", "\u001B[32mbaz\u001B[0m"));
CandidateListCompletionHandler handler = new CandidateListCompletionHandler();
handler.setStripAnsi(true);
console.setCompletionHandler(handler);
for (Completer c : completors) {
console.addCompleter(c);
}
// History h = console.getHistory();
// ("hoge\rhoge");
StringBuilder sb = new StringBuilder();
while (true) {
String line = console.readLine();
if (line == null) {
return null;
}
if (line.equals("")) {
return sb.toString();
}
sb.append(line);
sb.append("\n");
}
// h = console.getHistory();
}
开发者ID:nez-peg,项目名称:konoha,代码行数:31,代码来源:Main.java
示例6: addCompleter
import jline.console.completer.CandidateListCompletionHandler; //导入依赖的package包/类
@Override
public void addCompleter(Completer completer) {
CandidateListCompletionHandler handler = new CandidateListCompletionHandler();
// handler.setPrintSpaceAfterFullCompletion(false);
console.setCompletionHandler(handler);
console.addCompleter(new JLineCompleter(completer));
}
开发者ID:anba,项目名称:es6draft,代码行数:8,代码来源:JLineConsole.java
注:本文中的jline.console.completer.CandidateListCompletionHandler类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论