io.termd.core.readline.Completion Java Examples

The following examples show how to use io.termd.core.readline.Completion. 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: Complete.java    From termd with Apache License 2.0 5 votes vote down vote up
@Override
public void apply(Readline.Interaction interaction) {
  Consumer<Completion> handler = interaction.completionHandler();
  if (handler != null) {
    Completion completion = new Completion(interaction);
    handler.accept(completion);
  } else {
    interaction.resume();
  }
}
 
Example #2
Source File: CompletionHandler.java    From arthas with Apache License 2.0 5 votes vote down vote up
@Override
public void accept(final Completion completion) {
    try {
        final String line = io.termd.core.util.Helper.fromCodePoints(completion.line());
        final List<CliToken> tokens = Collections.unmodifiableList(CliTokens.tokenize(line));
        com.taobao.arthas.core.shell.cli.Completion comp = new CompletionAdaptor(line, tokens, completion, session);
        completionHandler.handle(comp);
    } catch (Throwable t) {
        // t.printStackTrace();
        logger.error("completion error", t);
    }
}
 
Example #3
Source File: Complete.java    From termd with Apache License 2.0 5 votes vote down vote up
@Override
public void apply(Readline.Interaction interaction) {
  Consumer<Completion> handler = interaction.completionHandler();
  if (handler != null) {
    Completion completion = new Completion(interaction);
    handler.accept(completion);
  } else {
    interaction.resume();
  }
}
 
Example #4
Source File: CompletionHandler.java    From arthas with Apache License 2.0 4 votes vote down vote up
public CompletionHandler(Handler<com.taobao.arthas.core.shell.cli.Completion> completionHandler, Session session) {
    this.completionHandler = completionHandler;
    this.session = session;
}