karaf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ff...@apache.org
Subject svn commit: r1458154 - /karaf/branches/karaf-2.x/shell/commands/src/main/java/org/apache/karaf/shell/commands/WatchAction.java
Date Tue, 19 Mar 2013 05:48:33 GMT
Author: ffang
Date: Tue Mar 19 05:48:33 2013
New Revision: 1458154

URL: http://svn.apache.org/r1458154
Log:
[KARAF-2230]Watch command - Add option to control if the console should clear or not

Modified:
    karaf/branches/karaf-2.x/shell/commands/src/main/java/org/apache/karaf/shell/commands/WatchAction.java

Modified: karaf/branches/karaf-2.x/shell/commands/src/main/java/org/apache/karaf/shell/commands/WatchAction.java
URL: http://svn.apache.org/viewvc/karaf/branches/karaf-2.x/shell/commands/src/main/java/org/apache/karaf/shell/commands/WatchAction.java?rev=1458154&r1=1458153&r2=1458154&view=diff
==============================================================================
--- karaf/branches/karaf-2.x/shell/commands/src/main/java/org/apache/karaf/shell/commands/WatchAction.java
(original)
+++ karaf/branches/karaf-2.x/shell/commands/src/main/java/org/apache/karaf/shell/commands/WatchAction.java
Tue Mar 19 05:48:33 2013
@@ -36,6 +36,9 @@ public class WatchAction extends Abstrac
 
     @Option(name = "-n", aliases = {"--interval"}, description = "The interval between executions
of the command in seconds", required = false, multiValued = false)
     private long interval = 1;
+    
+    @Option(name = "-a", aliases = {"--append"}, description = "The output should be appended
but not clear the console", required = false, multiValued = false)
+    private boolean append = false;
 
     @Argument(index = 0, name = "command", description = "The command to watch / refresh",
required = true, multiValued = true)
     private String[] arguments;
@@ -92,8 +95,10 @@ public class WatchAction extends Abstrac
                 output = byteArrayOutputStream.toString();
                 // make sure before displaying that this is not a forgotten long running
task
                 if (doDisplay) {
-                    System.out.print("\33[2J");
-                    System.out.print("\33[1;1H");
+                    if (!append) {
+                        System.out.print("\33[2J");
+                        System.out.print("\33[1;1H");
+                    }
                     System.out.print(output);
                     System.out.flush();
                 }



Mime
View raw message