mainLogger.addHandler(handler); reader.addCompletor(new JLineCompletorAdapter(getParser()));
public void addCompleter(final Completor completer) { assert completer != null; reader.addCompletor(completer); }
public void addCompleter(final Completor completer) { assert completer != null; reader.addCompletor(completer); }
public static void setCompletor(ConsoleHolder holder, Completor completor) { if (holder.readline != null) { holder.readline.removeCompletor(holder.currentCompletor); } holder.currentCompletor = completor; if (holder.readline != null) { holder.readline.addCompletor(holder.currentCompletor); } }
private void setCompletor() { // always remove existing Iterator iter = reader.getCompletors().iterator(); while (iter.hasNext()) { reader.removeCompletor((Completor) iter.next()); iter = reader.getCompletors().iterator(); } Set triggers = currentCtx.getCommandsGroup().getTriggers(); reader.addCompletor(new SimpleCompletor((String[]) triggers.toArray(new String[triggers.size()]))); }
@Override public void run() { System.out.print(prompt); try { //BufferedReader sysReader = new BufferedReader(new InputStreamReader(System.in)); ConsoleReader consoleReader = new ConsoleReader(); List<Completor> completors = new ArrayList<Completor>(); completors.add(new SimpleCompletor(commands)); //completors.add(new FileNameCompletor()); //completors.add(new ClassNameCompletor()); completors.add(new NullCompletor()); consoleReader.addCompletor(new ArgumentCompletor(completors)); String sysline; //不使用ConsoleReader设置prompt,否者返回信息前也有prompt了 while ((sysline = consoleReader.readLine()) != null) { //System.out.println("inspect>:" + sysline); distWriter.write(sysline); distWriter.newLine(); distWriter.flush(); if (Protocol.isQuit(sysline)) { return; //退出监听console输入 } } } catch (IOException e) { Log.warn("", e); } } }, "listenConsole").start();
reader.addCompletor(new CommandNameCompletor());
reader.addCompletor(new CommandNameCompletor());
reader.addCompletor(new CommandNameCompletor());
reader.addCompletor(new CommandNameCompletor());
consoleReader.addCompletor (new SimpleCompletor (oldCommands));
private void initJline() throws Exception { // String osName = System.getProperty("os.name"); // if (osName.startsWith("Windows")) { // return; // } consoleReader = new ConsoleReader(); consoleReader.setBellEnabled(false); // consoleReader.setDebug(new java.io.PrintWriter("jline-debug.txt")); History history = consoleReader.getHistory(); if (history == null) { history = new History(); consoleReader.setHistory(history); } File historyFile = new File(System.getProperty("user.home"), ".gfshhistory"); history.setHistoryFile(historyFile); // reader.setDebug(new PrintWriter(new FileWriter("writer.debug", true))); List completors = new LinkedList(); completors.add(new SimpleCompletor(commands)); consoleReader.addCompletor(new ArgumentCompletor(completors)); }
public static Object createJLineReader(final Shell shell) throws IOException { ConsoleReader reader = new ConsoleReader(); fixCtrlC(reader); // Add a Ctrl-c listener reader.addTriggeredAction((char)3, new ActionListener() { public void actionPerformed(ActionEvent e) { shell.bye(); System.exit(0); } }); reader.setBellEnabled(false); // TODO: write a Completor specific to this that can handle the individual command arguments List<Completor> completors = new LinkedList<Completor>(); // completors.add(new SimpleCompletor(Shell.COMMANDS)); // completors.add(new ICURICompletor(shell.node)); // completors.add(new FileNameCompletor()); // reader.addCompletor(new ArgumentCompletor(completors)); reader.addCompletor(new TShellCompletor(shell)); return reader; }
public static Object createJLineReader(final Shell shell) throws IOException { ConsoleReader reader = new ConsoleReader(); fixCtrlC(reader); // Add a Ctrl-c listener reader.addTriggeredAction((char)3, new ActionListener() { public void actionPerformed(ActionEvent e) { shell.bye(); System.exit(0); } }); reader.setBellEnabled(false); // TODO: write a Completor specific to this that can handle the individual command arguments List<Completor> completors = new LinkedList<Completor>(); // completors.add(new SimpleCompletor(Shell.COMMANDS)); // completors.add(new ICURICompletor(shell.node)); // completors.add(new FileNameCompletor()); // reader.addCompletor(new ArgumentCompletor(completors)); reader.addCompletor(new TShellCompletor(shell)); return reader; }
session.put(".jline.history", reader.getHistory()); if (completer != null) { reader.addCompletor( new CompleterAsCompletor( new AggregateCompleter(
reader.addCompletor(new FileNameCompletor()); reader.addCompletor(new SimpleCompletor(COMMANDS.keySet().toArray(new String[COMMANDS.size()])));
reader.addCompletor(new FileNameCompletor()); reader.addCompletor(new SimpleCompletor(COMMANDS.keySet().toArray(new String[COMMANDS.size()])));
_cr.addCompletor( _completionHandler ); _cr.printString( "Type \"help\" to see available commands" ); _cr.printNewline();
_cr.addCompletor( _completionHandler ); _cr.printString( "Type \"help\" to see available commands" ); _cr.printNewline();
protected static void initReadline(Ruby runtime, ConsoleHolder holder) throws IOException { holder.readline = new ConsoleReader(); holder.readline.setUseHistory(false); holder.readline.setUsePagination(true); holder.readline.setBellEnabled(false); ((CandidateListCompletionHandler) holder.readline.getCompletionHandler()).setAlwaysIncludeNewline(false); if (holder.currentCompletor == null) { holder.currentCompletor = new RubyFileNameCompletor(); } holder.readline.addCompletor(holder.currentCompletor); holder.readline.setHistory(holder.history); }