[Japi-cvs] SF.net SVN: japi:[781] libs/argparser/trunk/src/prj/net/sf/japi/io/args/ ArgParser.java
Status: Beta
                
                Brought to you by:
                
                    christianhujer
                    
                
            | 
      
      
      From: <chr...@us...> - 2009-01-24 22:29:02
      
     | 
| Revision: 781
          http://japi.svn.sourceforge.net/japi/?rev=781&view=rev
Author:   christianhujer
Date:     2009-01-24 22:15:07 +0000 (Sat, 24 Jan 2009)
Log Message:
-----------
Finished handling of arguments that start with '@', '@' is escaped with '@@'.
Modified Paths:
--------------
    libs/argparser/trunk/src/prj/net/sf/japi/io/args/ArgParser.java
Modified: libs/argparser/trunk/src/prj/net/sf/japi/io/args/ArgParser.java
===================================================================
--- libs/argparser/trunk/src/prj/net/sf/japi/io/args/ArgParser.java	2009-01-12 06:45:57 UTC (rev 780)
+++ libs/argparser/trunk/src/prj/net/sf/japi/io/args/ArgParser.java	2009-01-24 22:15:07 UTC (rev 781)
@@ -43,11 +43,11 @@
  * @todo better handling of boolean arguments
  * @todo Handling of - for STDIN as input argument filestream
  * @todo automatic printout of default values if property getter available.
- * @todo Let the programmer choose whether long options with one dash should be supported (for Ragnor). If long options with one dash are supported, short option concatenation should be disabled.
+ * @todo Let the programmer choose whether long options with one dash should be supported (for Ragnor).
+ *       If long options with one dash are supported, short option concatenation should be disabled.
  * @todo Abbreviation of long options as long as the abbreviation is unique
  * @todo Alternative way of getting arguments by a callback mechanism which processes single arguments.
  * @todo Move option names into a / the properties file.
- * @todo Handling of arguments that start with '@'. Escape with '@@'?
  */
 public final class ArgParser {
 
@@ -117,10 +117,14 @@
             }
             if (arg.startsWith("@")) {
                 iterator.remove();
-                final String filename = arg.substring(1);
-                final File file = new File(context.getParentFile(), filename);
-                for (final String insertArg : getAllArguments(file, readFromFile(file))) {
-                    iterator.add(insertArg);
+                if (arg.startsWith("@@")) {
+                    iterator.add(arg.substring(1));
+                } else {
+                    final String filename = arg.substring(1);
+                    final File file = new File(context.getParentFile(), filename);
+                    for (final String insertArg : getAllArguments(file, readFromFile(file))) {
+                        iterator.add(insertArg);
+                    }
                 }
             }
         }
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
 |