Esempio n. 1
0
 private static MemoryHistory getHistory() {
   MemoryHistory history;
   File historyFile = new File(getUserHome(), ".presto_history");
   try {
     history = new FileHistory(historyFile);
   } catch (IOException e) {
     System.err.printf(
         "WARNING: Failed to load history file (%s): %s. "
             + "History will not be available during this session.%n",
         historyFile, e.getMessage());
     history = new MemoryHistory();
   }
   history.setAutoTrim(true);
   return history;
 }
Esempio n. 2
0
 public AnsiTerminalCommand(
     File historyFile, int historySize, boolean useColor, UserAdminShell shell) {
   _useColors = useColor;
   _userAdminShell = shell;
   if (historyFile != null && (!historyFile.exists() || historyFile.isFile())) {
     try {
       _history = new FileHistory(historyFile);
       _history.setMaxSize(historySize);
     } catch (IOException e) {
       _logger.warn("History creation failed: " + e.getMessage());
     }
   }
 }