Package jline.console.completer

Examples of jline.console.completer.StringsCompleter


public class RouteCompleter extends CamelCompleterSupport {

    @SuppressWarnings({"unchecked", "rawtypes"})
    public int complete(String buffer, int cursor, List candidates) {
        try {
            StringsCompleter delegate = new StringsCompleter();
            List<Route> routes = camelController.getRoutes(null);
            for (Route route : routes) {
                delegate.getStrings().add(route.getId());
            }
            return delegate.complete(buffer, cursor, candidates);
        } catch (Exception e) {
            // nothing to do, no completion
        }
        return 0;
    }
View Full Code Here


                String longestName = pd.getLongestName();
                options.add(longestName);
            }
            Collections.sort(options);

            ArgumentCompleter commandCompleter = new ArgumentCompleter(new StringsCompleter(
                    commandName), new StringsCompleter(options));
            completers.add(commandCompleter);
        }

        completers.add(new StringsCompleter("exit", "clear"));

        Completer completer = new AggregateCompleter(completers);
        consoleReader.addCompleter(completer);
    }
View Full Code Here

     *
     * @return The command completer
     */
    private Completer getCommandCompleter() {
        if("gogo".equals(shellType)) {
            return new StringsCompleter(
                    "bundlelevel",
                    "cd",
                    "frameworklevel",
                    "headers",
                    "help",
                    "inspect",
                    "install",
                    "lb",
                    "log",
                    "ls",
                    "refresh",
                    "resolve",
                    "start",
                    "stop",
                    "uninstall",
                    "update",
                    "which",
                    "cat",
                    "each",
                    "echo",
                    "format",
                    "getopt",
                    "gosh",
                    "grep",
                    "not",
                    "set",
                    "sh",
                    "source",
                    "tac",
                    "telnetd",
                    "type",
                    "until",
                    "deploy",
                    "info",
                    "javadoc",
                    "list",
                    "repos",
                    "source"
                    );
        } else if("felix".equals(shellType)) {
            return new StringsCompleter(
                    "exit",
                    "quit",
                    "help",
                    "bundlelevel",
                    "cd",
View Full Code Here

      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);
    }
View Full Code Here

public class ArgumentCompleterTest
    extends ConsoleReaderTestSupport
{
    @Test
    public void test1() throws Exception {
        console.addCompleter(new ArgumentCompleter(new StringsCompleter("foo", "bar", "baz")));

        assertBuffer("foo foo ", new Buffer("foo f").tab());
        assertBuffer("foo ba", new Buffer("foo b").tab());
        assertBuffer("foo ba", new Buffer("foo ba").tab());
        assertBuffer("foo baz ", new Buffer("foo baz").tab());
View Full Code Here

public class StringsCompleterTest
    extends ConsoleReaderTestSupport
{
    @Test
    public void test1() throws Exception {
        console.addCompleter(new StringsCompleter("foo", "bar", "baz"));

        assertBuffer("foo ", new Buffer("f").tab());
        // single tab completes to unambiguous "ba"
        assertBuffer("ba", new Buffer("b").tab());
        assertBuffer("ba", new Buffer("ba").tab());
View Full Code Here

                }
                else if (args[0].equals("files")) {
                    completors.add(new FileNameCompleter());
                }
                else if (args[0].equals("simple")) {
                    completors.add(new StringsCompleter("foo", "bar", "baz"));
                }
                else if (args[0].equals("color")) {
                    color = true;
                    reader.setPrompt("\u001B[1mfoo\u001B[0m@bar\u001B[32m@baz\u001B[0m> ");
                }
View Full Code Here

    }

    @Override
    public Iterable<Completer> getCompleters() {
        return ImmutableList.<Completer>of(new ArgumentCompleter(
                new StringsCompleter("app"), new StringsCompleter("new", "run", "compile", "generate-start-script")));
    }
View Full Code Here

    }

    @Override
    public Iterable<Completer> getCompleters() {
        return ImmutableList.<Completer>of(new ArgumentCompleter(
                new StringsCompleter("hash"),
                new StringsCompleter("md5", "sha1", "bcrypt", "md5+bcrypt", "sha1+bcrypt")));
    }
View Full Code Here

    }

    @Override
    public Iterable<Completer> getCompleters() {
        return ImmutableList.<Completer>of(new ArgumentCompleter(
                new StringsCompleter("deps"), new StringsCompleter("install", "add")));
    }
View Full Code Here

TOP

Related Classes of jline.console.completer.StringsCompleter

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.