You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by sg...@apache.org on 2010/09/14 23:20:25 UTC

svn commit: r997101 - in /commons/proper/exec/trunk/src: changes/changes.xml site/apt/commandline.apt

Author: sgoeschl
Date: Tue Sep 14 21:20:24 2010
New Revision: 997101

URL: http://svn.apache.org/viewvc?rev=997101&view=rev
Log:
Updating documentation

Modified:
    commons/proper/exec/trunk/src/changes/changes.xml
    commons/proper/exec/trunk/src/site/apt/commandline.apt

Modified: commons/proper/exec/trunk/src/changes/changes.xml
URL: http://svn.apache.org/viewvc/commons/proper/exec/trunk/src/changes/changes.xml?rev=997101&r1=997100&r2=997101&view=diff
==============================================================================
--- commons/proper/exec/trunk/src/changes/changes.xml (original)
+++ commons/proper/exec/trunk/src/changes/changes.xml Tue Sep 14 21:20:24 2010
@@ -24,6 +24,10 @@
     </properties>
     <body>
         <release version="1.1-SNAPSHOT" date="as in SVN" description="Maintenance Release">
+            <action dev="sgoeschl" type="add" date="2010-09-02" >
+                Reverting changes of [EXEC-41] because the patch does not fix the problem.
+                Also added test case for the broken patch.
+            </action>
             <action dev="sgoeschl" type="add" date="2010-08-17" >
                 Added TutorialTest as a playground for new user and removed
                 similar code from DefaultExecutorTest.

Modified: commons/proper/exec/trunk/src/site/apt/commandline.apt
URL: http://svn.apache.org/viewvc/commons/proper/exec/trunk/src/site/apt/commandline.apt?rev=997101&r1=997100&r2=997101&view=diff
==============================================================================
--- commons/proper/exec/trunk/src/site/apt/commandline.apt (original)
+++ commons/proper/exec/trunk/src/site/apt/commandline.apt Tue Sep 14 21:20:24 2010
@@ -54,7 +54,7 @@ Building the command line
 .\\bin\\vim
 ----------------------------------------
 
-* Parsing the command line string
+* Parsing the entire command line string
 
   Parsing the command line string is easy to use but you might run into
   problems when tackling complex scenarios. Therefore this functionality
@@ -78,3 +78,75 @@ cmd.exe /C c:\was51\Web Sphere\AppServer
 ----------------------------------------
 String line = "cmd.exe /C 'c:\\was51\\Web Sphere\\AppServer\\bin\\versionInfo.bat'";
 ----------------------------------------
+
+* Building the Command Line Incrementally
+
+  This is the recommended approach and caters also for pre-quoted command
+  line argument.
+
+** A simple example
+
+  Now we would like to build the following command line
+
+----------------------------------------
+runMemorySud.cmd 10 30 -XX:+UseParallelGC -XX:ParallelGCThreads=2
+----------------------------------------
+
+  using the following code snippet
+  
+----------------------------------------
+CommandLine cmdl = new CommandLine("runMemorySud.cmd");
+cmdl.addArgument("10");
+cmdl.addArgument("30");
+cmdl.addArgument("-XX:+UseParallelGC");
+cmdl.addArgument("-XX:ParallelGCThreads=2");
+----------------------------------------
+
+** A complex example
+
+  Now let's have a look at the following command line found somewhere in the
+  internet
+
+----------------------------------------
+dotnetfx.exe /q:a /c:"install.exe /l ""\Documents and Settings\myusername\Local Settings\Temp\netfx.log"" /q"
+----------------------------------------
+
+  The following code snippet builds the command line using pre-quoted
+  arguments and variable expansion
+
+----------------------------------------
+File file = new File("/Documents and Settings/myusername/Local Settings/Temp/netfx.log");
+Map map = new HashMap();
+map.put("FILE", file);
+
+cmdl = new CommandLine("dotnetfx.exe");
+cmdl.setSubstitutionMap(map);
+cmdl.addArgument("/q:a", false);
+cmdl.addArgument("/c:\"install.exe /l \"\"${FILE}\"\" /q\"", false);
+----------------------------------------
+
+* For the Desperate
+
+  When crafting a command line it would be really helpful to see what
+  happens to your command line arguments. The following scripts can be
+  invoked to print your command line arguments for Unix
+
+----------------------------------------
+while [ $# -gt 0 ]
+do
+    echo "$1"
+    shift
+done
+----------------------------------------
+
+  and for Windows
+
+----------------------------------------
+:Loop
+IF [%1]==[] GOTO Continue
+    @ECHO "%1"
+SHIFT
+GOTO Loop
+:Continue
+----------------------------------------
+