geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jdil...@apache.org
Subject svn commit: r465534 - /geronimo/sandbox/gshell/trunk/gshell-cli/src/main/java/org/apache/geronimo/gshell/cli/Main.java
Date Thu, 19 Oct 2006 08:53:57 GMT
Author: jdillon
Date: Thu Oct 19 01:53:56 2006
New Revision: 465534

URL: http://svn.apache.org/viewvc?view=rev&rev=465534
Log:
Add -c/--commands flag to pass in a complete command-line to execute

Modified:
    geronimo/sandbox/gshell/trunk/gshell-cli/src/main/java/org/apache/geronimo/gshell/cli/Main.java

Modified: geronimo/sandbox/gshell/trunk/gshell-cli/src/main/java/org/apache/geronimo/gshell/cli/Main.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/gshell/trunk/gshell-cli/src/main/java/org/apache/geronimo/gshell/cli/Main.java?view=diff&rev=465534&r1=465533&r2=465534
==============================================================================
--- geronimo/sandbox/gshell/trunk/gshell-cli/src/main/java/org/apache/geronimo/gshell/cli/Main.java
(original)
+++ geronimo/sandbox/gshell/trunk/gshell-cli/src/main/java/org/apache/geronimo/gshell/cli/Main.java
Thu Oct 19 01:53:56 2006
@@ -67,6 +67,8 @@
 
     private boolean interactive;
 
+    private String commands;
+
     public Main(final ClassWorld world) {
         assert world != null;
         this.world = world;
@@ -114,6 +116,12 @@
             .withArgName("name=value")
             .create('D'));
 
+        options.addOption(OptionBuilder.withLongOpt("commands")
+            .withDescription("Read commands from string")
+            .hasArg()
+            .withArgName("string")
+            .create('c'));
+        
         options.addOption(OptionBuilder.withLongOpt("interactive")
             .withDescription("Run in interactive mode")
             .create('i'));
@@ -198,6 +206,10 @@
             setConsoleLogLevel("WARN");
         }
 
+        if (line.hasOption('c')) {
+            commands = line.getOptionValue('c');
+        }
+
         if (line.hasOption('i')) {
             interactive = true;
         }
@@ -244,8 +256,11 @@
         //
         // TODO: Pass interactive flags (maybe as property) so gshell knows what mode it
is
         //
-
-        if (interactive) {
+        
+        if (commands != null) {
+            gshell.execute(commands);
+        }
+        else if (interactive) {
             log.debug("Starting interactive console");
 
             //



Mime
View raw message