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


Java ArgumentCompleter类代码示例

本文整理汇总了Java中jline.console.completer.ArgumentCompleter的典型用法代码示例。如果您正苦于以下问题:Java ArgumentCompleter类的具体用法?Java ArgumentCompleter怎么用?Java ArgumentCompleter使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


ArgumentCompleter类属于jline.console.completer包,在下文中一共展示了ArgumentCompleter类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getConsole

import jline.console.completer.ArgumentCompleter; //导入依赖的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: CommandCompleter

import jline.console.completer.ArgumentCompleter; //导入依赖的package包/类
public CommandCompleter(ConsoleReader consoleReader,
		ArgumentDelimiter argumentDelimiter, Iterable<Command> commands) {
	this.console = consoleReader;
	List<String> names = new ArrayList<String>();
	for (Command command : commands) {
		this.commands.add(command);
		names.add(command.getName());
		List<String> options = new ArrayList<String>();
		for (OptionHelp optionHelp : command.getOptionsHelp()) {
			options.addAll(optionHelp.getOptions());
		}
		AggregateCompleter argumentCompleters = new AggregateCompleter(
				new StringsCompleter(options), new FileNameCompleter());
		ArgumentCompleter argumentCompleter = new ArgumentCompleter(argumentDelimiter,
				argumentCompleters);
		argumentCompleter.setStrict(false);
		this.commandCompleters.put(command.getName(), argumentCompleter);
	}
	getStrings().addAll(names);
}
 
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:21,代码来源:CommandCompleter.java

示例3: CommandCompleter

import jline.console.completer.ArgumentCompleter; //导入依赖的package包/类
public CommandCompleter(ConsoleReader consoleReader,
		ArgumentDelimiter argumentDelimiter, Iterable<Command> commands) {
	this.console = consoleReader;
	List<String> names = new ArrayList<String>();
	for (Command command : commands) {
		this.commands.add(command);
		names.add(command.getName());
		List<String> options = new ArrayList<String>();
		for (OptionHelp optionHelp : command.getOptionsHelp()) {
			options.addAll(optionHelp.getOptions());
		}
		AggregateCompleter arguementCompleters = new AggregateCompleter(
				new StringsCompleter(options), new FileNameCompleter());
		ArgumentCompleter argumentCompleter = new ArgumentCompleter(argumentDelimiter,
				arguementCompleters);
		argumentCompleter.setStrict(false);
		this.commandCompleters.put(command.getName(), argumentCompleter);
	}
	getStrings().addAll(names);
}
 
开发者ID:Nephilim84,项目名称:contestparser,代码行数:21,代码来源:CommandCompleter.java

示例4: askForWorkflow

import jline.console.completer.ArgumentCompleter; //导入依赖的package包/类
private void askForWorkflow() {
    log.info("Press ENTER for getting started info");
    log.info("");

    log.info("Press tab to see a list of available workflows, up to see previously entered workflows");

    ArgumentCompleter argumentsCompleter = createWorkflowCompleter();

    String workFlowText = InputUtils.readValue("Workflow(Type " + EXIT_WORKFLOW + " to exit)",
            argumentsCompleter, workflowHistory).trim();
    if (workFlowText.equals(EXIT_WORKFLOW)) {
        log.info("Exiting");
        System.exit(0);
    }
    String[] workflowTextPieces = splitWorkflowTextIntoArguments(workFlowText);
    configParser.updateWithRuntimeArguments(config, workflowTextPieces);
}
 
开发者ID:vmware,项目名称:workflowTools,代码行数:18,代码来源:Workflow.java

示例5: SqlLineCommandCompleter

import jline.console.completer.ArgumentCompleter; //导入依赖的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

示例6: resetCompletors

import jline.console.completer.ArgumentCompleter; //导入依赖的package包/类
protected void resetCompletors() {
    removeAllcompleters();
    addcompleters(new AggregateCompleter(
        Collections2.transform(commandMappings.keySet(), new Function<Call, Completer>() {
            @Override
            public Completer apply(final Call input) {
                return new ArgumentCompleter(
                    ImmutableList.<Completer>builder()
                        .add(new StringsCompleter(input.commandName()))
                        .add(input.completers())
                        .build()
                );
            }
        })
    ));
}
 
开发者ID:shopzilla,项目名称:hadoop-in-a-box,代码行数:17,代码来源:HadoopREPL.java

示例7: Init

import jline.console.completer.ArgumentCompleter; //导入依赖的package包/类
/** Client initialization */
public void Init( String url ) {

    if( url != null && !url.equals( "" ) )
        _server_url = url;

    try {
        _servidor = new XmlRpcClientBase( _server_url );

        _reader = new ConsoleReader();
        _reader.setBellEnabled( false );
        List completors = new LinkedList();

        completors.add( new StringsCompleter( _commandList ) );
        _reader.addCompleter( new ArgumentCompleter( completors ) );

    } catch (Exception exception) {
        System.err.println("error: " + exception.toString());
    }
}
 
开发者ID:jenbabis22,项目名称:MXCashMarketDataDrv,代码行数:21,代码来源:DriverClient.java

示例8: setCommands

import jline.console.completer.ArgumentCompleter; //导入依赖的package包/类
public void setCommands(CommandSet.Entry[] entries) throws IOException {
    AggregateCompleter aggregateCompleter = new AggregateCompleter(new SimpleCompletor(getCommandsAsArray(entries)),
                                                                   new ClassNameCompletor(),
                                                                   new FileNameCompleter());

    ArgumentCompleter argumentCompleter = new ArgumentCompleter(createArgumentDelimiter(), aggregateCompleter);
    argumentCompleter.setStrict(false);
    reader.addCompleter(argumentCompleter);
}
 
开发者ID:ow2-proactive,项目名称:scheduling,代码行数:10,代码来源:JLineDevice.java

示例9: createArgumentDelimiter

import jline.console.completer.ArgumentCompleter; //导入依赖的package包/类
private ArgumentCompleter.WhitespaceArgumentDelimiter createArgumentDelimiter() {
    return new ArgumentCompleter.WhitespaceArgumentDelimiter() {
        @Override
        public boolean isDelimiterChar(CharSequence buffer, int pos) {
            return super.isDelimiterChar(buffer, pos) || buffer.charAt(pos) == '\'' || buffer.charAt(pos) == '"' ||
                   buffer.charAt(pos) == '{' || buffer.charAt(pos) == '}' || buffer.charAt(pos) == ',' ||
                   buffer.charAt(pos) == ';';
        }
    };
}
 
开发者ID:ow2-proactive,项目名称:scheduling,代码行数:11,代码来源:JLineDevice.java

示例10: getArgumentCompleter

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

示例11: getArgumentCompleter

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

示例12: getArgumentCompleter

import jline.console.completer.ArgumentCompleter; //导入依赖的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

示例13: getArgumentCompleter

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

示例14: getArgumentCompleter

import jline.console.completer.ArgumentCompleter; //导入依赖的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

示例15: getArgumentCompleter

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


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