geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jdil...@apache.org
Subject svn commit: r571353 - /geronimo/sandbox/gshell/trunk/gshell-cli/src/main/java/org/apache/geronimo/gshell/cli/Main.java
Date Fri, 31 Aug 2007 01:37:41 GMT
Author: jdillon
Date: Thu Aug 30 18:37:41 2007
New Revision: 571353

URL: http://svn.apache.org/viewvc?rev=571353&view=rev
Log:
Use method to simplify the --quiet,--debug,--verbose processing
Set the short version of the above to -q, -d and -v

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=571353&r1=571352&r2=571353&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
Thu Aug 30 18:37:41 2007
@@ -84,14 +84,26 @@
     @Option(name="-i", aliases={"--interactive"}, description="Run in interactive mode")
     private boolean interactive = true;
 
-    @Option(name="-debug", aliases={"--debug"}, description="Enable DEBUG logging output")
-    private boolean debug;
+    @Option(name="-d", aliases={"--debug"}, description="Enable DEBUG logging output")
+    private void setDebug(boolean flag) {
+        if (flag) {
+            setConsoleLogLevel("DEBUG");
+        }
+    }
 
-    @Option(name="-verbose", aliases={"--verbose"}, description="Enable INFO logging output")
-    private boolean verbose;
+    @Option(name="-v", aliases={"--verbose"}, description="Enable INFO logging output")
+    private void setVerbose(boolean flag) {
+        if (flag) {
+            setConsoleLogLevel("INFO");
+        }
+    }
 
-    @Option(name="-quite", aliases={"--quiet"}, description="Limit logging output to ERROR")
-    private boolean quiet;
+    @Option(name="-q", aliases={"--quiet"}, description="Limit logging output to ERROR")
+    private void setQuiet(boolean flag) {
+        if (flag) {
+            setConsoleLogLevel("ERROR");
+        }
+    }
 
     @Option(name="-c", aliases={"--commands"}, description="Read commands from string")
     private String commands;
@@ -122,6 +134,9 @@
     public void run(final String[] args) throws Exception {
         assert args != null;
 
+        // Default is to be quiet
+        setConsoleLogLevel("WARN");
+        
         CommandLineProcessor clp = new CommandLineProcessor(this);
         clp.setStopAtNonOption(true);
         clp.process(args);
@@ -149,20 +164,6 @@
             io.out.flush();
 
             System.exit(0);
-        }
-
-        if (quiet) {
-            setConsoleLogLevel("ERROR");
-        }
-        else if (debug) {
-            setConsoleLogLevel("DEBUG");
-        }
-        else if (verbose) {
-            setConsoleLogLevel("INFO");
-        }
-        else {
-            // Default is to be quiet
-            setConsoleLogLevel("WARN");
         }
 
         int code;



Mime
View raw message