geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jdil...@apache.org
Subject svn commit: r571639 - /geronimo/sandbox/gshell/trunk/gshell-commands/gshell-builtins/src/main/java/org/apache/geronimo/gshell/commands/builtins/HelpCommand.java
Date Fri, 31 Aug 2007 22:58:27 GMT
Author: jdillon
Date: Fri Aug 31 15:58:26 2007
New Revision: 571639

URL: http://svn.apache.org/viewvc?rev=571639&view=rev
Log:
For now just make 'help' list commands

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

Modified: geronimo/sandbox/gshell/trunk/gshell-commands/gshell-builtins/src/main/java/org/apache/geronimo/gshell/commands/builtins/HelpCommand.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/gshell/trunk/gshell-commands/gshell-builtins/src/main/java/org/apache/geronimo/gshell/commands/builtins/HelpCommand.java?rev=571639&r1=571638&r2=571639&view=diff
==============================================================================
--- geronimo/sandbox/gshell/trunk/gshell-commands/gshell-builtins/src/main/java/org/apache/geronimo/gshell/commands/builtins/HelpCommand.java
(original)
+++ geronimo/sandbox/gshell/trunk/gshell-commands/gshell-builtins/src/main/java/org/apache/geronimo/gshell/commands/builtins/HelpCommand.java
Fri Aug 31 15:58:26 2007
@@ -19,7 +19,6 @@
 
 package org.apache.geronimo.gshell.commands.builtins;
 
-import org.apache.geronimo.gshell.clp.Argument;
 import org.apache.geronimo.gshell.command.CommandDefinition;
 import org.apache.geronimo.gshell.command.CommandManager;
 import org.apache.geronimo.gshell.command.CommandSupport;
@@ -37,67 +36,31 @@
     // @Requirement
     private CommandManager commandManager;
 
-    @Argument(description="Help topic")
-    private String topic = "topics";
-
     public HelpCommand() {
         super("help");
     }
 
-    protected String getUsage() {
-        return super.getUsage() + " [topic|command]";
-    }
-
     protected Object doExecute() throws Exception {
-
         IO io = getIO();
 
-        //
-        // TODO: Externalize strings
-        //
-
-        //
-        // TODO: Reuse our command bits...
-        //
-
-        if (topic.equals("topics")) {
-            io.out.println("Available topics:");
-            io.out.println("  topics");
-            io.out.println("  commands");
-            io.out.println();
-        }
-        else if (topic.equals("commands")) {
-            io.out.println("Available commands (and aliases):");
+        io.out.println("Available commands:");
 
-            //
-            // HACK: For now just list all know commands
-            //
-
-            for (CommandDefinition def : commandManager.commandDefinitions()) {
-                io.out.print("  ");
-                io.out.print(def.getName());
-
-                // Include a list of aliases
-                String[] aliases = def.getAliases();
-                if (aliases.length != 0) {
-                    io.out.print(" ( ");
-                    io.out.print(Arguments.asString(aliases));
-                    io.out.print(" )");
-                }
-
-                io.out.println();
+        for (CommandDefinition def : commandManager.commandDefinitions()) {
+            io.out.print("  ");
+            io.out.print(def.getName());
+
+            // Include a list of aliases
+            String[] aliases = def.getAliases();
+            if (aliases.length != 0) {
+                io.out.print(" ( ");
+                io.out.print(Arguments.asString(aliases));
+                io.out.print(" )");
             }
 
             io.out.println();
         }
-        else {
-            //
-            // TODO: When given a command name as a topic, then execute cmd --help
-            //
 
-            io.err.println("Unknown help topic: " + topic);
-            io.err.println();
-        }
+        io.out.println();
 
         return SUCCESS;
     }



Mime
View raw message