public String interpretLine(String line, Session session, Output out) throws ShellException { if (line == null || line.trim().length() == 0) { return ""; } line = replaceAlias(line, session); AppCommandParser parser = new AppCommandParser(this, line); return parser.app().execute(parser, session, out); }
public TabCompletion tabComplete(String partOfLine, Session session) throws ShellException, RemoteException { // TODO We can't assume it's an AppShellServer, can we? AppCommandParser parser = new AppCommandParser(this, partOfLine); App app = parser.app(); List<String> appCandidates = app.completionCandidates(partOfLine, session); appCandidates = quote(appCandidates); if (appCandidates.size() == 1) { appCandidates.set(0, appCandidates.get(0) + " "); } int cursor = partOfLine.length() - TextUtil.lastWordOrQuoteOf(partOfLine, true).length(); return new TabCompletion(appCandidates, cursor); }