geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jdil...@apache.org
Subject svn commit: r698851 - in /geronimo/gshell/trunk/gshell-commands/gshell-builtins/src/main: java/org/apache/geronimo/gshell/commands/builtins/ resources/META-INF/spring/ resources/org/apache/geronimo/gshell/commands/builtins/
Date Thu, 25 Sep 2008 07:50:01 GMT
Author: jdillon
Date: Thu Sep 25 00:50:01 2008
New Revision: 698851

URL: http://svn.apache.org/viewvc?rev=698851&view=rev
Log:
Added 'history' command

Added:
    geronimo/gshell/trunk/gshell-commands/gshell-builtins/src/main/java/org/apache/geronimo/gshell/commands/builtins/HistoryAction.java
  (with props)
    geronimo/gshell/trunk/gshell-commands/gshell-builtins/src/main/resources/org/apache/geronimo/gshell/commands/builtins/HistoryAction.properties
  (with props)
Modified:
    geronimo/gshell/trunk/gshell-commands/gshell-builtins/src/main/resources/META-INF/spring/components.xml

Added: geronimo/gshell/trunk/gshell-commands/gshell-builtins/src/main/java/org/apache/geronimo/gshell/commands/builtins/HistoryAction.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-commands/gshell-builtins/src/main/java/org/apache/geronimo/gshell/commands/builtins/HistoryAction.java?rev=698851&view=auto
==============================================================================
--- geronimo/gshell/trunk/gshell-commands/gshell-builtins/src/main/java/org/apache/geronimo/gshell/commands/builtins/HistoryAction.java
(added)
+++ geronimo/gshell/trunk/gshell-commands/gshell-builtins/src/main/java/org/apache/geronimo/gshell/commands/builtins/HistoryAction.java
Thu Sep 25 00:50:01 2008
@@ -0,0 +1,60 @@
+/*
+ * 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 org.apache.geronimo.gshell.command.CommandAction;
+import org.apache.geronimo.gshell.command.CommandContext;
+import org.apache.geronimo.gshell.io.IO;
+import org.apache.geronimo.gshell.ansi.Renderer;
+import org.apache.geronimo.gshell.ansi.Code;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.codehaus.plexus.util.StringUtils;
+import jline.History;
+
+import java.util.List;
+
+/**
+ * Display history.
+ *
+ * @version $Rev$ $Date$
+ */
+public class HistoryAction
+    implements CommandAction
+{
+    @Autowired
+    private History history;
+
+    public Object execute(final CommandContext context) throws Exception {
+        assert context != null;
+        IO io = context.getIo();
+
+        // noinspection unchecked
+        List<String> elements = history.getHistoryList();
+
+        int i = 0;
+        for (String element : elements) {
+            String index = StringUtils.leftPad(String.valueOf(i), 3, " ");
+            io.info("  {}  {}", Renderer.encode(index, Code.BOLD), element);
+            i++;
+        }
+
+        return Result.SUCCESS;
+    }
+}
\ No newline at end of file

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

Propchange: geronimo/gshell/trunk/gshell-commands/gshell-builtins/src/main/java/org/apache/geronimo/gshell/commands/builtins/HistoryAction.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/HistoryAction.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: geronimo/gshell/trunk/gshell-commands/gshell-builtins/src/main/resources/META-INF/spring/components.xml
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-commands/gshell-builtins/src/main/resources/META-INF/spring/components.xml?rev=698851&r1=698850&r2=698851&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-commands/gshell-builtins/src/main/resources/META-INF/spring/components.xml
(original)
+++ geronimo/gshell/trunk/gshell-commands/gshell-builtins/src/main/resources/META-INF/spring/components.xml
Thu Sep 25 00:50:01 2008
@@ -56,6 +56,20 @@
             <gshell:command name="unset">
                 <gshell:action class="org.apache.geronimo.gshell.commands.builtins.UnsetAction"/>
             </gshell:command>
+
+            <!--
+            <gshell:command name="alias">
+                <gshell:action class="org.apache.geronimo.gshell.commands.builtins.AliasAction"/>
+            </gshell:command>
+
+            <gshell:command name="unalias">
+                <gshell:action class="org.apache.geronimo.gshell.commands.builtins.UnaliasAction"/>
+            </gshell:command>
+            -->
+            
+            <gshell:command name="history">
+                <gshell:action class="org.apache.geronimo.gshell.commands.builtins.HistoryAction"/>
+            </gshell:command>
         </gshell:command-bundle>
     </gshell:plugin>
 

Added: geronimo/gshell/trunk/gshell-commands/gshell-builtins/src/main/resources/org/apache/geronimo/gshell/commands/builtins/HistoryAction.properties
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-commands/gshell-builtins/src/main/resources/org/apache/geronimo/gshell/commands/builtins/HistoryAction.properties?rev=698851&view=auto
==============================================================================
--- geronimo/gshell/trunk/gshell-commands/gshell-builtins/src/main/resources/org/apache/geronimo/gshell/commands/builtins/HistoryAction.properties
(added)
+++ geronimo/gshell/trunk/gshell-commands/gshell-builtins/src/main/resources/org/apache/geronimo/gshell/commands/builtins/HistoryAction.properties
Thu Sep 25 00:50:01 2008
@@ -0,0 +1,29 @@
+##
+## 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.
+##
+
+##
+## $Rev$ $Date$
+##
+
+command.name=history
+
+command.description=Display history.
+
+command.manual=\
+  TODO: history manual
\ No newline at end of file

Propchange: geronimo/gshell/trunk/gshell-commands/gshell-builtins/src/main/resources/org/apache/geronimo/gshell/commands/builtins/HistoryAction.properties
------------------------------------------------------------------------------
    svn:eol-style = native

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

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



Mime
View raw message