Return-Path: Delivered-To: apmail-geronimo-scm-archive@www.apache.org Received: (qmail 71493 invoked from network); 25 Jun 2006 22:33:39 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 25 Jun 2006 22:33:39 -0000 Received: (qmail 83865 invoked by uid 500); 25 Jun 2006 22:33:39 -0000 Delivered-To: apmail-geronimo-scm-archive@geronimo.apache.org Received: (qmail 83824 invoked by uid 500); 25 Jun 2006 22:33:38 -0000 Mailing-List: contact scm-help@geronimo.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: Reply-To: dev@geronimo.apache.org List-Id: Delivered-To: mailing list scm@geronimo.apache.org Received: (qmail 83813 invoked by uid 99); 25 Jun 2006 22:33:38 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 25 Jun 2006 15:33:38 -0700 X-ASF-Spam-Status: No, hits=-9.4 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: local policy) Received: from [140.211.166.113] (HELO eris.apache.org) (140.211.166.113) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 25 Jun 2006 15:33:36 -0700 Received: by eris.apache.org (Postfix, from userid 65534) id E330D1A983A; Sun, 25 Jun 2006 15:33:15 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r417081 - in /geronimo/sandbox/gshell/trunk/gshell-core/src/main: java/org/apache/geronimo/gshell/builtins/SetCommand.java resources/org/apache/geronimo/gshell/builtins/SetCommandMessages.properties Date: Sun, 25 Jun 2006 22:33:15 -0000 To: scm@geronimo.apache.org From: jdillon@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20060625223315.E330D1A983A@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Author: jdillon Date: Sun Jun 25 15:33:13 2006 New Revision: 417081 URL: http://svn.apache.org/viewvc?rev=417081&view=rev Log: Display variables or properties when set called w/o args Modified: geronimo/sandbox/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/builtins/SetCommand.java geronimo/sandbox/gshell/trunk/gshell-core/src/main/resources/org/apache/geronimo/gshell/builtins/SetCommandMessages.properties Modified: geronimo/sandbox/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/builtins/SetCommand.java URL: http://svn.apache.org/viewvc/geronimo/sandbox/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/builtins/SetCommand.java?rev=417081&r1=417080&r2=417081&view=diff ============================================================================== --- geronimo/sandbox/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/builtins/SetCommand.java (original) +++ geronimo/sandbox/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/builtins/SetCommand.java Sun Jun 25 15:33:13 2006 @@ -29,6 +29,7 @@ import org.apache.geronimo.gshell.console.IO; import java.util.Iterator; +import java.util.Properties; /** * Set a variable or property. @@ -44,7 +45,7 @@ PROPERTY } - private boolean displayVariables; + private boolean display; private Mode mode = Mode.VARIABLE; @@ -75,7 +76,7 @@ String[] args = line.getArgs(); if (args.length == 0) { - displayVariables = true; + display = true; } if (line.hasOption('p')) { @@ -90,19 +91,40 @@ IO io = getIO(); - // No args... list all variables - if (displayVariables) { - Variables vars = getVariables(); - Iterator iter = vars.names(); - - while (iter.hasNext()) { - String name = iter.next(); - Object value = vars.get(name); - - io.out.print(name); - io.out.print("="); - io.out.print(value); - io.out.println(); + // No args... list all properties or variables + if (display) { + switch (mode) { + case PROPERTY: { + Properties props = System.getProperties(); + Iterator iter = props.keySet().iterator(); + + while (iter.hasNext()) { + String name = (String)iter.next(); + String value = props.getProperty(name); + + io.out.print(name); + io.out.print("="); + io.out.print(value); + io.out.println(); + } + break; + } + + case VARIABLE: { + Variables vars = getVariables(); + Iterator iter = vars.names(); + + while (iter.hasNext()) { + String name = iter.next(); + Object value = vars.get(name); + + io.out.print(name); + io.out.print("="); + io.out.print(value); + io.out.println(); + } + break; + } } return Command.SUCCESS; Modified: geronimo/sandbox/gshell/trunk/gshell-core/src/main/resources/org/apache/geronimo/gshell/builtins/SetCommandMessages.properties URL: http://svn.apache.org/viewvc/geronimo/sandbox/gshell/trunk/gshell-core/src/main/resources/org/apache/geronimo/gshell/builtins/SetCommandMessages.properties?rev=417081&r1=417080&r2=417081&view=diff ============================================================================== --- geronimo/sandbox/gshell/trunk/gshell-core/src/main/resources/org/apache/geronimo/gshell/builtins/SetCommandMessages.properties (original) +++ geronimo/sandbox/gshell/trunk/gshell-core/src/main/resources/org/apache/geronimo/gshell/builtins/SetCommandMessages.properties Sun Jun 25 15:33:13 2006 @@ -16,4 +16,4 @@ cli.usage.description=Set a variable or property -cli.usage.footer=With no arguments, current variables are displayed as name=value \ No newline at end of file +cli.usage.footer=With no arguments, current variables (or properties) are displayed as name=value \ No newline at end of file