if (mask == null && isHistoryEnabled()) { history.add(historyLine);
if (reader.isHistoryEnabled()) { History history = reader.getHistory(); if (history instanceof FileHistory) {
if (mask == null && isHistoryEnabled()) { history.add(historyLine);
throw new CliException("More than one application in Application Package match '" + matchAppName + "'"); } else { boolean useHistory = reader.isHistoryEnabled(); reader.setHistoryEnabled(false); History previousHistory = reader.getHistory();
} else { boolean useHistory = reader.isHistoryEnabled(); reader.setHistoryEnabled(false); History previousHistory = reader.getHistory();
@Override public String readLine(String prompt) throws IOException { boolean oldHistoryEnabled = reader.isHistoryEnabled(); History oldHistory = reader.getHistory(); Collection<Completer> oldCompleters = new ArrayList<>(reader.getCompleters()); String oldPrompt = reader.getPrompt(); try { reader.setHistoryEnabled(false); reader.setHistory(new MemoryHistory()); for (Completer c : oldCompleters) { reader.removeCompleter(c); } String result = reader.readLine(prompt); return result; } finally { for (Completer c : oldCompleters) { reader.addCompleter(c); } reader.setPrompt(oldPrompt); reader.setHistory(oldHistory); reader.setHistoryEnabled(oldHistoryEnabled); } } }