You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by jd...@apache.org on 2007/11/17 02:23:49 UTC

svn commit: r595891 - /geronimo/gshell/trunk/gshell-commands/gshell-builtins/src/main/java/org/apache/geronimo/gshell/commands/builtins/ClearCommand.java

Author: jdillon
Date: Fri Nov 16 17:23:47 2007
New Revision: 595891

URL: http://svn.apache.org/viewvc?rev=595891&view=rev
Log:
(GSHELL-37) Complain if ANSI is not enabled, since JLine clear impl relys on ANSI

Modified:
    geronimo/gshell/trunk/gshell-commands/gshell-builtins/src/main/java/org/apache/geronimo/gshell/commands/builtins/ClearCommand.java

Modified: geronimo/gshell/trunk/gshell-commands/gshell-builtins/src/main/java/org/apache/geronimo/gshell/commands/builtins/ClearCommand.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-commands/gshell-builtins/src/main/java/org/apache/geronimo/gshell/commands/builtins/ClearCommand.java?rev=595891&r1=595890&r2=595891&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-commands/gshell-builtins/src/main/java/org/apache/geronimo/gshell/commands/builtins/ClearCommand.java (original)
+++ geronimo/gshell/trunk/gshell-commands/gshell-builtins/src/main/java/org/apache/geronimo/gshell/commands/builtins/ClearCommand.java Fri Nov 16 17:23:47 2007
@@ -28,6 +28,7 @@
 import org.apache.geronimo.gshell.command.CommandSupport;
 import org.apache.geronimo.gshell.command.annotation.CommandComponent;
 import org.apache.geronimo.gshell.command.annotation.Requirement;
+import org.apache.geronimo.gshell.ansi.ANSI;
 
 /**
  * Clear the terminal screen.
@@ -44,7 +45,13 @@
     protected Object doExecute() throws Exception {
         ConsoleReader reader = new ConsoleReader(io.inputStream, new PrintWriter(io.outputStream, true), /*bindings*/ null, terminal);
         
-        reader.clearScreen();
+        if (!ANSI.isEnabled()) {
+        	io.out.println("ANSI is not enabled.  The clear command is not functional");
+        }
+        else {
+        	reader.clearScreen();
+        	return SUCCESS;
+        }
         
         return SUCCESS;
     }