geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jdil...@apache.org
Subject svn commit: r570970 - /geronimo/sandbox/gshell/trunk/gshell-cli/src/main/java/org/apache/geronimo/gshell/cli/Main.java
Date Wed, 29 Aug 2007 22:57:05 GMT
Author: jdillon
Date: Wed Aug 29 15:57:04 2007
New Revision: 570970

URL: http://svn.apache.org/viewvc?rev=570970&view=rev
Log:
Re-add support for -D name=value and --define name=value

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?rev=570970&r1=570969&r2=570970&view=diff
==============================================================================
--- 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
Wed Aug 29 15:57:04 2007
@@ -75,23 +75,6 @@
         System.setProperty("gshell.log.console.level", level);
     }
 
-    private void setPropertyFrom(final String namevalue) {
-        String name, value;
-        int i = namevalue.indexOf("=");
-
-        if (i == -1) {
-            name = namevalue;
-            value = Boolean.TRUE.toString();
-        }
-        else {
-            name = namevalue.substring(0, i);
-            value = namevalue.substring(i + 1, namevalue.length());
-        }
-        name = name.trim();
-
-        System.setProperty(name, value);
-    }
-
     @Option(name="-h", aliases={"--help"}, description="Display this help message")
     private boolean help;
 
@@ -110,24 +93,35 @@
     @Option(name="-quite", aliases={"--quiet"}, description="Limit logging output to ERROR")
     private boolean quiet;
 
-    @Option(name="-c", aliases={"commands"}, description="Read commands from string")
+    @Option(name="-c", aliases={"--commands"}, description="Read commands from string")
     private String commands;
 
     @Argument(description="Command")
     private List<String> args;
 
+    @Option(name="-D", aliases={"--define"}, metaVar="NAME=VALUE", description="Define system
properties")
+    private void setSystemProperty(final String nameValue) {
+        assert nameValue != null;
+
+        String name, value;
+        int i = namevVlue.indexOf("=");
+
+        if (i == -1) {
+            name = nameValue;
+            value = Boolean.TRUE.toString();
+        }
+        else {
+            name = nameValue.substring(0, i);
+            value = nameValue.substring(i + 1, nameValue.length());
+        }
+        name = name.trim();
+
+        System.setProperty(name, value);
+    }
+
     public void run(final String[] args) throws Exception {
         assert args != null;
 
-        // FIXME:
-        /*
-        options.addOption(OptionBuilder.withLongOpt("define")
-            .withDescription("Define a system property")
-            .hasArg()
-            .withArgName("name=value")
-            .create('D'));
-        */
-
         CommandLineProcessor clp = new CommandLineProcessor(this);
         clp.setStopAtNonOption(true);
         clp.process(args);
@@ -156,17 +150,6 @@
 
             System.exit(0);
         }
-
-        // FIXME:
-        /*
-        if (line.hasOption('D')) {
-            String[] values = line.getOptionValues('D');
-
-            for (String value : values) {
-                setPropertyFrom(value);
-            }
-        }
-        */
 
         if (quiet) {
             setConsoleLogLevel("ERROR");



Mime
View raw message