当前位置: 首页>>代码示例>>Java>>正文


Java NullCompleter类代码示例

本文整理汇总了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;
}
 
开发者ID:needle-wang,项目名称:jweevely,代码行数:24,代码来源:JweevelyClient.java

示例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);
}
 
开发者ID:mozafari,项目名称:verdict,代码行数:17,代码来源:SqlLineCommandCompleter.java

示例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);
}
 
开发者ID:rainu,项目名称:jsimpleshell-rc,代码行数:25,代码来源:RemoteCompleter.java

示例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;
}
 
开发者ID:fabianlipp,项目名称:jnami,代码行数:27,代码来源:CliParser.java

示例5: getArgumentCompleter

import jline.console.completer.NullCompleter; //导入依赖的package包/类
@Override
public ArgumentCompleter getArgumentCompleter() {
  return new ArgumentCompleter(
      new StringsCompleter(getCommand()),
      new SessionVarCompleter(),
      NullCompleter.INSTANCE);
}
 
开发者ID:apache,项目名称:tajo,代码行数:8,代码来源:UnsetCommand.java

示例6: getArgumentCompleter

import jline.console.completer.NullCompleter; //导入依赖的package包/类
@Override
public ArgumentCompleter getArgumentCompleter() {
  return new ArgumentCompleter(
      new StringsCompleter(getCommand()),
      new TableNameCompleter(),
      NullCompleter.INSTANCE);
}
 
开发者ID:apache,项目名称:tajo,代码行数:8,代码来源:DescTableCommand.java

示例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);
}
 
开发者ID:apache,项目名称:tajo,代码行数:15,代码来源:TajoGetConfCommand.java

示例8: getArgumentCompleter

import jline.console.completer.NullCompleter; //导入依赖的package包/类
@Override
public ArgumentCompleter getArgumentCompleter() {
  return new ArgumentCompleter(
      new StringsCompleter(getCommand()),
      new DbNameCompleter(),
      NullCompleter.INSTANCE);
}
 
开发者ID:apache,项目名称:tajo,代码行数:8,代码来源:ConnectDatabaseCommand.java

示例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);
}
 
开发者ID:apache,项目名称:tajo,代码行数:12,代码来源:HelpCommand.java

示例10: getArgumentCompleter

import jline.console.completer.NullCompleter; //导入依赖的package包/类
@Override
public ArgumentCompleter getArgumentCompleter() {
  return new ArgumentCompleter(
      new StringsCompleter(getCommand()),
      new FunctionNameCompleter(),
      NullCompleter.INSTANCE);
}
 
开发者ID:apache,项目名称:tajo,代码行数:8,代码来源:DescFunctionCommand.java

示例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;
  }
}
 
开发者ID:mozafari,项目名称:verdict,代码行数:16,代码来源:AbstractCommandHandler.java

示例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);
}
 
开发者ID:apache,项目名称:tajo,代码行数:7,代码来源:TajoShellCommand.java

示例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();
}
 
开发者ID:shopzilla,项目名称:hadoop-in-a-box,代码行数:6,代码来源:Call.java


注:本文中的jline.console.completer.NullCompleter类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。