geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jdil...@apache.org
Subject svn commit: r592930 - /geronimo/gshell/trunk/gshell-commands/gshell-builtins/src/main/java/org/apache/geronimo/gshell/commands/builtins/ClearCommand.java
Date Wed, 07 Nov 2007 22:40:43 GMT
Author: jdillon
Date: Wed Nov  7 14:40:43 2007
New Revision: 592930

URL: http://svn.apache.org/viewvc?rev=592930&view=rev
Log:
(GSHELL-37) Adding 'clear' command; contributed by Jason Warner

Added:
    geronimo/gshell/trunk/gshell-commands/gshell-builtins/src/main/java/org/apache/geronimo/gshell/commands/builtins/ClearCommand.java
  (with props)

Added: 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=592930&view=auto
==============================================================================
--- geronimo/gshell/trunk/gshell-commands/gshell-builtins/src/main/java/org/apache/geronimo/gshell/commands/builtins/ClearCommand.java
(added)
+++ geronimo/gshell/trunk/gshell-commands/gshell-builtins/src/main/java/org/apache/geronimo/gshell/commands/builtins/ClearCommand.java
Wed Nov  7 14:40:43 2007
@@ -0,0 +1,46 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.geronimo.gshell.commands.builtins;
+
+import java.io.IOException;
+import java.io.PrintWriter;
+
+import jline.ConsoleReader;
+import jline.Terminal;
+
+import org.apache.geronimo.gshell.command.CommandSupport;
+import org.apache.geronimo.gshell.command.annotation.CommandComponent;
+import org.apache.geronimo.gshell.command.annotation.Requirement;
+
+@CommandComponent(id="clear", description="Clear the terminal screen")
+public class ClearCommand
+    extends CommandSupport
+{
+    @Requirement
+    private Terminal terminal;
+    
+    protected Object doExecute() throws Exception {
+        ConsoleReader reader = new ConsoleReader(io.inputStream, new PrintWriter(io.outputStream,
true), /*bindings*/ null, terminal);
+        
+        reader.clearScreen();
+        
+        return SUCCESS;
+    }
+}

Propchange: geronimo/gshell/trunk/gshell-commands/gshell-builtins/src/main/java/org/apache/geronimo/gshell/commands/builtins/ClearCommand.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/gshell/trunk/gshell-commands/gshell-builtins/src/main/java/org/apache/geronimo/gshell/commands/builtins/ClearCommand.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: geronimo/gshell/trunk/gshell-commands/gshell-builtins/src/main/java/org/apache/geronimo/gshell/commands/builtins/ClearCommand.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain



Mime
View raw message