org.jline.reader.impl.completer.NullCompleter Java Examples

The following examples show how to use org.jline.reader.impl.completer.NullCompleter. 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 Project: xraft   Author: xnnyygn   File:    License: MIT License 6 votes vote down vote up
public Console(Map<NodeId, Address> serverMap) {
    commandMap = buildCommandMap(Arrays.asList(
            new ExitCommand(),
            new ClientAddServerCommand(),
            new ClientRemoveServerCommand(),
            new ClientListServerCommand(),
            new ClientGetLeaderCommand(),
            new ClientSetLeaderCommand(),
            new RaftAddNodeCommand(),
            new RaftRemoveNodeCommand(),
            new KVStoreGetCommand(),
            new KVStoreSetCommand()
    commandContext = new CommandContext(serverMap);

    ArgumentCompleter completer = new ArgumentCompleter(
            new StringsCompleter(commandMap.keySet()),
            new NullCompleter()
    reader = LineReaderBuilder.builder()
Example #2
Source Project: sqlline   Author: julianhyde   File:    License: BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
SqlLineCommandCompleter(SqlLine sqlLine) {
  super(new LinkedList<>());
  List<Completer> completers = new LinkedList<>();

  for (CommandHandler commandHandler : sqlLine.getCommandHandlers()) {
    for (String cmd : commandHandler.getNames()) {
      List<Completer> compl = new LinkedList<>();
      final List<Completer> parameterCompleters =
      if (parameterCompleters.size() == 1
          && parameterCompleters.iterator().next()
              instanceof Completers.RegexCompleter) {
      } else {
        final String commandName = SqlLine.COMMAND_PREFIX + cmd;
        final String helpText = commandHandler.getHelpText();
        final int firstEndOfLineIndex = helpText.indexOf('\n');
            new StringsCompleter(
                new SqlLineCandidate(sqlLine,
                    AttributedString.stripAnsi(commandName), commandName,
                    firstEndOfLineIndex == -1
                        ? helpText
                        : helpText.substring(0, firstEndOfLineIndex),
                    // there could be whatever else instead helpText
                    // which is the same for commands with all theirs aliases
                    null, helpText, true)));
        compl.add(new NullCompleter()); // last param no complete
        completers.add(new ArgumentCompleter(compl));

Example #3
Source Project: sqlline   Author: julianhyde   File:    License: BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
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(new NullCompleter());
  } else {
    this.parameterCompleters = new ArrayList<>(completers);
Example #4
Source Project: batfish   Author: batfish   File:    License: Apache License 2.0 4 votes vote down vote up
public Client(Settings settings) {
  _additionalBatfishOptions = new HashMap<>();
  _bfq = new TreeMap<>();
  _settings = settings;

  switch (_settings.getRunMode()) {
    case batch:
      if (_settings.getBatchCommandFile() == null) {
            "org.batfish.client: Command file not specified while running in batch mode.");
            "Use '-%s <cmdfile>' if you want batch mode, or '-%s interactive' if you want "
                + "interactive mode\n",
            Settings.ARG_COMMAND_FILE, Settings.ARG_RUN_MODE);
      _logger = new BatfishLogger(_settings.getLogLevel(), false, _settings.getLogFile());
    case interactive:
          "This is not a supported client for Batfish. Please use pybatfish following the "
              + "instructions in the README:");
      try {
        _reader =
                .completer(new ArgumentCompleter(new CommandCompleter(), new NullCompleter()))
        Path historyPath = Paths.get(System.getenv(ENV_HOME), HISTORY_FILE);
        _reader.setVariable(LineReader.HISTORY_FILE, historyPath.toAbsolutePath().toString());
        _reader.unsetOpt(Option.INSERT_TAB); // supports completion with nothing entered

        @SuppressWarnings("PMD.CloseResource") // PMD does not understand things closed later.
        PrintWriter pWriter = new PrintWriter(_reader.getTerminal().output(), true);
        @SuppressWarnings("PMD.CloseResource") // PMD does not understand things closed later.
        OutputStream os = new WriterOutputStream(pWriter, StandardCharsets.UTF_8);
        @SuppressWarnings("PMD.CloseResource") // PMD does not understand things closed later.
        PrintStream ps = new PrintStream(os, true);
        _logger = new BatfishLogger(_settings.getLogLevel(), false, ps);
      } catch (Exception e) {
        System.err.printf("Could not initialize client: %s\n", e.getMessage());
      System.err.println("org.batfish.client: Unknown run mode.");