jline.console.completer.AggregateCompleter Java Examples

The following examples show how to use jline.console.completer.AggregateCompleter. 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 File: JLineDevice.java    From scheduling with GNU Affero General Public License v3.0 5 votes vote down vote up
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);
}
 
Example #2
Source File: TajoCli.java    From tajo with Apache License 2.0 5 votes vote down vote up
private void initCommands() {
  List<Completer> compList = new ArrayList<>();
  for (Class clazz : registeredCommands) {
    TajoShellCommand cmd = null;

    try {
       Constructor cons = clazz.getConstructor(new Class[] {TajoCliContext.class});
       cmd = (TajoShellCommand) cons.newInstance(context);
    } catch (Exception e) {
      System.err.println(e.getMessage());
      throw new RuntimeException(e.getMessage());
    }

    // make completers for console auto-completion
    compList.add(cmd.getArgumentCompleter());

    commands.put(cmd.getCommand(), cmd);
    for (String alias : cmd.getAliases()) {
      commands.put(alias, cmd);
    }
  }

  cliCompleter = new AggregateCompleter(compList);

  sqlCompleter = new ArgumentCompleter(
      new ArgumentCompleter.AbstractArgumentDelimiter() {
        @Override
        public boolean isDelimiterChar(CharSequence buf, int pos) {
          char c = buf.charAt(pos);
          return Character.isWhitespace(c) || !(Character.isLetterOrDigit(c)) && c != '_';
        }
      },
      new StringsCompleter(getKeywords())
  );
}
 
Example #3
Source File: ApexCli.java    From Bats with Apache License 2.0 4 votes vote down vote up
private void setupCompleter(ConsoleReader reader)
{
  reader.addCompleter(new AggregateCompleter(defaultCompleters()));
}
 
Example #4
Source File: ApexCli.java    From attic-apex-core with Apache License 2.0 4 votes vote down vote up
private void setupCompleter(ConsoleReader reader)
{
  reader.addCompleter(new AggregateCompleter(defaultCompleters()));
}