Author: gnodet
Date: Tue Oct 13 13:49:13 2009
New Revision: 824761
URL: http://svn.apache.org/viewvc?rev=824761&view=rev
Log:
FELIX-1748: make the command history persistent across restarts
Modified:
felix/trunk/karaf/shell/console/src/main/java/org/apache/felix/karaf/shell/console/jline/Console.java
Modified:
felix/trunk/karaf/shell/console/src/main/java/org/apache/felix/karaf/shell/console/jline/Console.java
URL:
http://svn.apache.org/viewvc/felix/trunk/karaf/shell/console/src/main/java/org/apache/felix/karaf/shell/console/jline/Console.java?rev=824761&r1=824760&r2=824761&view=diff
==============================================================================
---
felix/trunk/karaf/shell/console/src/main/java/org/apache/felix/karaf/shell/console/jline/Console.java
(original)
+++
felix/trunk/karaf/shell/console/src/main/java/org/apache/felix/karaf/shell/console/jline/Console.java
Tue Oct 13 13:49:13 2009
@@ -18,6 +18,7 @@
*/
package org.apache.felix.karaf.shell.console.jline;
+import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.io.InterruptedIOException;
@@ -67,7 +68,7 @@
Terminal term,
Completer completer,
Runnable closeCallback,
- Callable<Boolean> printStackTraces ) throws Exception
+ Callable<Boolean> printStackTraces) throws Exception
{
this.in = in;
this.out = out;
@@ -84,6 +85,10 @@
new PrintWriter(this.out),
getClass().getResourceAsStream("keybinding.properties"),
this.terminal);
+
+ File file = new File(System.getProperty("user.home"),
".karaf/karaf.history");
+ file.getParentFile().mkdirs();
+ reader.getHistory().setHistoryFile(file);
if (completer != null) {
reader.addCompletor(new CompleterAsCompletor(completer));
}