You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@karaf.apache.org by jb...@apache.org on 2013/07/01 21:49:20 UTC

svn commit: r1498644 - in /karaf/trunk/shell/commands/src/main: java/org/apache/karaf/shell/commands/impl/AliasAction.java resources/META-INF/services/org/apache/karaf/shell/commands resources/OSGI-INF/blueprint/shell-commands.xml

Author: jbonofre
Date: Mon Jul  1 19:49:20 2013
New Revision: 1498644

URL: http://svn.apache.org/r1498644
Log:
[KARAF-2370] Add the alias command

Added:
    karaf/trunk/shell/commands/src/main/java/org/apache/karaf/shell/commands/impl/AliasAction.java
Modified:
    karaf/trunk/shell/commands/src/main/resources/META-INF/services/org/apache/karaf/shell/commands
    karaf/trunk/shell/commands/src/main/resources/OSGI-INF/blueprint/shell-commands.xml

Added: karaf/trunk/shell/commands/src/main/java/org/apache/karaf/shell/commands/impl/AliasAction.java
URL: http://svn.apache.org/viewvc/karaf/trunk/shell/commands/src/main/java/org/apache/karaf/shell/commands/impl/AliasAction.java?rev=1498644&view=auto
==============================================================================
--- karaf/trunk/shell/commands/src/main/java/org/apache/karaf/shell/commands/impl/AliasAction.java (added)
+++ karaf/trunk/shell/commands/src/main/java/org/apache/karaf/shell/commands/impl/AliasAction.java Mon Jul  1 19:49:20 2013
@@ -0,0 +1,34 @@
+/*
+ * 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.karaf.shell.commands.impl;
+
+import org.apache.karaf.shell.commands.Argument;
+import org.apache.karaf.shell.commands.Command;
+import org.apache.karaf.shell.console.AbstractAction;
+
+@Command(scope = "shell", name = "alias", description = "Create an alias to a command")
+public class AliasAction extends AbstractAction {
+
+    @Argument(index = 0, name = "command", description = "The command to alias, e.g. 'ldn = { log:display -n $args }'", required = true, multiValued = false)
+    private String alias;
+
+    protected Object doExecute() throws Exception {
+        session.execute(alias);
+        return null;
+    }
+
+}

Modified: karaf/trunk/shell/commands/src/main/resources/META-INF/services/org/apache/karaf/shell/commands
URL: http://svn.apache.org/viewvc/karaf/trunk/shell/commands/src/main/resources/META-INF/services/org/apache/karaf/shell/commands?rev=1498644&r1=1498643&r2=1498644&view=diff
==============================================================================
--- karaf/trunk/shell/commands/src/main/resources/META-INF/services/org/apache/karaf/shell/commands (original)
+++ karaf/trunk/shell/commands/src/main/resources/META-INF/services/org/apache/karaf/shell/commands Mon Jul  1 19:49:20 2013
@@ -14,6 +14,7 @@
 ##  See the License for the specific language governing permissions and
 ##  limitations under the License.
 ##---------------------------------------------------------------------------
+org.apache.karaf.shell.commands.impl.AliasAction
 org.apache.karaf.shell.commands.impl.CatAction
 org.apache.karaf.shell.commands.impl.ClearAction
 org.apache.karaf.shell.commands.impl.DateAction

Modified: karaf/trunk/shell/commands/src/main/resources/OSGI-INF/blueprint/shell-commands.xml
URL: http://svn.apache.org/viewvc/karaf/trunk/shell/commands/src/main/resources/OSGI-INF/blueprint/shell-commands.xml?rev=1498644&r1=1498643&r2=1498644&view=diff
==============================================================================
--- karaf/trunk/shell/commands/src/main/resources/OSGI-INF/blueprint/shell-commands.xml (original)
+++ karaf/trunk/shell/commands/src/main/resources/OSGI-INF/blueprint/shell-commands.xml Mon Jul  1 19:49:20 2013
@@ -21,6 +21,9 @@
 
     <command-bundle xmlns="http://karaf.apache.org/xmlns/shell/v1.1.0">
         <command>
+            <action class="org.apache.karaf.shell.commands.impl.AliasAction"/>
+        </command>
+        <command>
             <action class="org.apache.karaf.shell.commands.impl.CatAction"/>
         </command>
         <command>