You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@karaf.apache.org by ff...@apache.org on 2013/03/19 06:57:21 UTC

svn commit: r1458160 - /karaf/trunk/shell/commands/src/main/java/org/apache/karaf/shell/commands/impl/WatchAction.java

Author: ffang
Date: Tue Mar 19 05:57:20 2013
New Revision: 1458160

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

Modified:
    karaf/trunk/shell/commands/src/main/java/org/apache/karaf/shell/commands/impl/WatchAction.java

Modified: karaf/trunk/shell/commands/src/main/java/org/apache/karaf/shell/commands/impl/WatchAction.java
URL: http://svn.apache.org/viewvc/karaf/trunk/shell/commands/src/main/java/org/apache/karaf/shell/commands/impl/WatchAction.java?rev=1458160&r1=1458159&r2=1458160&view=diff
==============================================================================
--- karaf/trunk/shell/commands/src/main/java/org/apache/karaf/shell/commands/impl/WatchAction.java (original)
+++ karaf/trunk/shell/commands/src/main/java/org/apache/karaf/shell/commands/impl/WatchAction.java Tue Mar 19 05:57:20 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;
@@ -91,8 +94,10 @@ public class WatchAction extends Abstrac
                 session.execute(command);
                 output = byteArrayOutputStream.toString();
                 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();
                 }