karaf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ff...@apache.org
Subject [karaf] branch master updated: [KARAF-5456]introduce a property karaf.shell.history.file.maxSize to configure the history file size on disk
Date Mon, 06 Nov 2017 08:59:55 GMT
This is an automated email from the ASF dual-hosted git repository.

ffang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/karaf.git


The following commit(s) were added to refs/heads/master by this push:
     new fc70bda  [KARAF-5456]introduce a property karaf.shell.history.file.maxSize to configure
the history file size on disk
fc70bda is described below

commit fc70bda293ce49f12cc8c04922567875eb86eacf
Author: Freeman Fang <freeman.fang@gmail.com>
AuthorDate: Mon Nov 6 16:59:42 2017 +0800

    [KARAF-5456]introduce a property karaf.shell.history.file.maxSize to configure the history
file size on disk
---
 .../base/src/main/resources/resources/etc/system.properties       | 8 +++++++-
 .../static/src/main/resources/resources/etc/system.properties     | 6 ++++++
 .../org/apache/karaf/shell/impl/console/ConsoleSessionImpl.java   | 5 +++++
 3 files changed, 18 insertions(+), 1 deletion(-)

diff --git a/assemblies/features/base/src/main/resources/resources/etc/system.properties b/assemblies/features/base/src/main/resources/resources/etc/system.properties
index 77c316d..6056eb6 100644
--- a/assemblies/features/base/src/main/resources/resources/etc/system.properties
+++ b/assemblies/features/base/src/main/resources/resources/etc/system.properties
@@ -61,6 +61,12 @@ karaf.shell.init.script = shell.init.script,scripts/*.script
 # karaf.shell.history.maxSize = 0
 
 #
+# Sets the maximum size of the local shell command history file. If not set,
+# defaults to 10000 entries.
+#
+# karaf.shell.history.file.maxSize = 10000
+
+#
 # Deletes the entire karaf.data directory at every start
 #
 karaf.clean.all = false
@@ -145,4 +151,4 @@ karaf.secured.services = (&(osgi.command.scope=*)(osgi.command.function=*))
 # By default, the slave instances start but are passive.
 # If you want to prevent the slave instances startup, you can use
 # the karaf.lock.slave.block property (false by default):
-# karaf.lock.slave.block=true
\ No newline at end of file
+# karaf.lock.slave.block=true
diff --git a/assemblies/features/static/src/main/resources/resources/etc/system.properties
b/assemblies/features/static/src/main/resources/resources/etc/system.properties
index a696c0f..9ac6155 100644
--- a/assemblies/features/static/src/main/resources/resources/etc/system.properties
+++ b/assemblies/features/static/src/main/resources/resources/etc/system.properties
@@ -61,6 +61,12 @@ karaf.shell.init.script = shell.init.script,scripts/*.script
 # karaf.shell.history.maxSize = 0
 
 #
+# Sets the maximum size of the local shell command history file. If not set,
+# defaults to 10000 entries.
+#
+# karaf.shell.history.file.maxSize = 10000
+
+#
 # Deletes the entire karaf.data directory at every start
 #
 karaf.clean.all = false
diff --git a/shell/core/src/main/java/org/apache/karaf/shell/impl/console/ConsoleSessionImpl.java
b/shell/core/src/main/java/org/apache/karaf/shell/impl/console/ConsoleSessionImpl.java
index d4fd7ba..e641f8f 100644
--- a/shell/core/src/main/java/org/apache/karaf/shell/impl/console/ConsoleSessionImpl.java
+++ b/shell/core/src/main/java/org/apache/karaf/shell/impl/console/ConsoleSessionImpl.java
@@ -86,6 +86,7 @@ public class ConsoleSessionImpl implements Session {
     private static final String SUPPRESS_WELCOME = "karaf.shell.suppress.welcome";
     public static final String SHELL_INIT_SCRIPT = "karaf.shell.init.script";
     public static final String SHELL_HISTORY_MAXSIZE = "karaf.shell.history.maxSize";
+    public static final String SHELL_HISTORY_FILE_MAXSIZE = "karaf.shell.history.file.maxSize";
     public static final String PROMPT = "PROMPT";
     public static final String DEFAULT_PROMPT = "\u001B[1m${USER}\u001B[0m@${APPLICATION}(${SUBSHELL})>
";
     public static final String RPROMPT = "RPROMPT";
@@ -186,6 +187,10 @@ public class ConsoleSessionImpl implements Session {
         if (maxSizeStr != null) {
             reader.setVariable(LineReader.HISTORY_SIZE, Integer.parseInt(maxSizeStr));
         }
+        String maxFileSizeStr = System.getProperty(SHELL_HISTORY_FILE_MAXSIZE);
+        if (maxFileSizeStr != null) {
+            reader.setVariable(LineReader.HISTORY_FILE_SIZE, Integer.parseInt(maxFileSizeStr));
+        }
         history = new HistoryWrapper(reader.getHistory());
 
         // Registry

-- 
To stop receiving notification emails like this one, please contact
['"commits@karaf.apache.org" <commits@karaf.apache.org>'].

Mime
View raw message