本文整理汇总了Java中jline.console.completer.NullCompleter类的典型用法代码示例。如果您正苦于以下问题:Java NullCompleter类的具体用法?Java NullCompleter怎么用?Java NullCompleter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
NullCompleter类属于jline.console.completer包,在下文中一共展示了NullCompleter类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getConsole
import jline.console.completer.NullCompleter; //导入依赖的package包/类
public ConsoleReader getConsole() throws IOException {
if (console == null) {
// console = new ConsoleReader(System.in, System.out);
console = new ConsoleReader();
}
String osName = builtIn.getLocalOsName();
if (osName.toLowerCase().contains("win")) {
System.out.println("-----your Console is terrible.-----\n"
+ "if it reports some errors, just ignore it.");
console.setPrompt("[email protected]" + builtIn.getHostname() + "> ");
} else {
console.setPrompt("\u001B[33mjweevely\u001B[[email protected]"
+ builtIn.getHostname() + "\u001B[33m>\u001B[0m ");
}
List<Completer> completors = new ArrayList<Completer>();
completors.add(new StringsCompleter(BuiltIn.BUILTIN_FUNCTION));
completors.add(new FileNameCompleter());
completors.add(new NullCompleter());
console.addCompleter(new ArgumentCompleter(completors));
return console;
}
示例2: SqlLineCommandCompleter
import jline.console.completer.NullCompleter; //导入依赖的package包/类
public SqlLineCommandCompleter(SqlLine sqlLine) {
List<ArgumentCompleter> completers = new LinkedList<ArgumentCompleter>();
for (CommandHandler commandHandler : sqlLine.commandHandlers) {
for (String cmd : commandHandler.getNames()) {
List<Completer> compl = new LinkedList<Completer>();
compl.add(new StringsCompleter(SqlLine.COMMAND_PREFIX + cmd));
compl.addAll(commandHandler.getParameterCompleters());
compl.add(new NullCompleter()); // last param no complete
completers.add(new ArgumentCompleter(compl));
}
}
getCompleters().addAll(completers);
}
示例3: complete
import jline.console.completer.NullCompleter; //导入依赖的package包/类
@Override
public int complete(String buffer, int cursor, List<CharSequence> candidates) {
Message response = null;
try{
sendCompleteRequest(buffer, cursor);
do{
response = connector.receive();
}while(response instanceof OutputMessage); //the completer cause a output (that can we ignore)
if(response instanceof CompleteResponse){
CompleteResponse completeResponse = (CompleteResponse)response;
candidates.addAll(completeResponse.getCandidates());
return completeResponse.getIndex();
}
throw new IOException("Unexpected completer response! " + response);
}catch(IOException e){
LOG.log(WARNING, "Could not complete line because the server sends an unexpected response!" + response, e);
}
return new NullCompleter().complete(buffer, cursor, candidates);
}
示例4: getCompleterForMethod
import jline.console.completer.NullCompleter; //导入依赖的package包/类
/**
* Erzeugt einen Completer für eine CliCommand-Methode. Dazu wird die
* entsprechende Annotation ausgelesen und mit der dort angegeben
* Factory-Klasse der Completer erzeugt.
*
* @param mtd
* Methode
* @return Der Completer, falls die Annotation vorhanden war und dieser
* erzeugt werden konnte; andernfalls wird ein
* <tt>NullCompleter</tt> zurückgegeben.
*/
private static Completer getCompleterForMethod(Method mtd) {
Completer completer = NullCompleter.INSTANCE;
if (mtd.isAnnotationPresent(ParamCompleter.class)) {
try {
ParamCompleter anno = mtd.getAnnotation(ParamCompleter.class);
Class<? extends CompleterFactory> complFacCls = anno.value();
CompleterFactory complFac = complFacCls.newInstance();
completer = complFac.getCompleter();
} catch (InstantiationException | IllegalAccessException e) {
log.log(Level.WARNING,
"Could not initialise completer for command", e);
}
}
return completer;
}
示例5: getArgumentCompleter
import jline.console.completer.NullCompleter; //导入依赖的package包/类
@Override
public ArgumentCompleter getArgumentCompleter() {
return new ArgumentCompleter(
new StringsCompleter(getCommand()),
new SessionVarCompleter(),
NullCompleter.INSTANCE);
}
示例6: getArgumentCompleter
import jline.console.completer.NullCompleter; //导入依赖的package包/类
@Override
public ArgumentCompleter getArgumentCompleter() {
return new ArgumentCompleter(
new StringsCompleter(getCommand()),
new TableNameCompleter(),
NullCompleter.INSTANCE);
}
示例7: getArgumentCompleter
import jline.console.completer.NullCompleter; //导入依赖的package包/类
@Override
public ArgumentCompleter getArgumentCompleter() {
TajoConf.ConfVars[] vars = TajoConf.ConfVars.values();
List<String> confNames = new ArrayList<>();
for(TajoConf.ConfVars varname: vars) {
confNames.add(varname.varname);
}
return new ArgumentCompleter(
new StringsCompleter(getCommand()),
new ConfCompleter(confNames.toArray(new String[confNames.size()])),
NullCompleter.INSTANCE);
}
示例8: getArgumentCompleter
import jline.console.completer.NullCompleter; //导入依赖的package包/类
@Override
public ArgumentCompleter getArgumentCompleter() {
return new ArgumentCompleter(
new StringsCompleter(getCommand()),
new DbNameCompleter(),
NullCompleter.INSTANCE);
}
示例9: getArgumentCompleter
import jline.console.completer.NullCompleter; //导入依赖的package包/类
@Override
public ArgumentCompleter getArgumentCompleter() {
List<String> cmds = new ArrayList<>(Arrays.asList(getAliases()));
cmds.add(getCommand());
return new ArgumentCompleter(
new StringsCompleter(cmds.toArray(new String[cmds.size()])),
new StringsCompleter("copyright", "version", "?", "help", "q", "l", "c", "d", "df", "!", "dfs", "admin",
"set", "unset", "haadmin", "getconf"), // same order as help string
NullCompleter.INSTANCE);
}
示例10: getArgumentCompleter
import jline.console.completer.NullCompleter; //导入依赖的package包/类
@Override
public ArgumentCompleter getArgumentCompleter() {
return new ArgumentCompleter(
new StringsCompleter(getCommand()),
new FunctionNameCompleter(),
NullCompleter.INSTANCE);
}
示例11: AbstractCommandHandler
import jline.console.completer.NullCompleter; //导入依赖的package包/类
public AbstractCommandHandler(SqlLine sqlLine, String[] names,
String helpText, List<Completer> completers) {
this.sqlLine = sqlLine;
name = names[0];
this.names = Arrays.asList(names);
this.helpText = helpText;
if (completers == null || completers.size() == 0) {
this.parameterCompleters =
Collections.singletonList((Completer) new NullCompleter());
} else {
List<Completer> c = new ArrayList<Completer>(completers);
c.add(new NullCompleter());
this.parameterCompleters = c;
}
}
示例12: getArgumentCompleter
import jline.console.completer.NullCompleter; //导入依赖的package包/类
public ArgumentCompleter getArgumentCompleter() {
List<String> cmds = new ArrayList<>(Arrays.asList(getAliases()));
cmds.add(getCommand());
return new ArgumentCompleter(new StringsCompleter(cmds.toArray(new String[cmds.size()])), NullCompleter.INSTANCE);
}
示例13: Call
import jline.console.completer.NullCompleter; //导入依赖的package包/类
public Call(final String commandName, final Completer... completers) {
this.commandName = commandName;
this.completers = Arrays.copyOf(completers, completers.length + 1);
this.completers[completers.length] = new NullCompleter();
}