Aquileo | Recent changes to bugshttps://sourceforge.net/p/cmdlineparser/bugs/Recent changes to bugsenTue, 04 Dec 2007 07:20:22 -0000Aquileo | Incorrect parsing of integer and enum switcheshttps://sourceforge.net/p/cmdlineparser/bugs/5/<div class="markdown_content"><p>Parsing</p> <p>program.exe -n 1 -m 2</p> <p>where n and m are integer switches fails. To solve this replace the line</p> <p>this.valuePattern = @")((?&lt;value&gt;.+))";</p> <p>with</p> <p>this.valuePattern = @")((?&lt;value&gt;\S+))";</p> <p>in IntSwitch.initialise()</p> <p>The same goes for enum switches. The solution here is to replace</p> <p>this.valuePattern = @")((?:"")(?&lt;value&gt;.+)(?:"")|(?&lt;value&gt;\S+))";</p> <p>with</p> <p>this.valuePattern = @")((?:"")(?&lt;value&gt;[^""]+)(?:"")|(?&lt;value&gt;\S+))";</p> <p>in EnumSwitch.initialise()</p></div>AnonymousTue, 04 Dec 2007 07:20:22 -0000https://sourceforge.netbc991142592304bb0a1ac3e8df8890b9144efd82Aquileo | Incorrect parsing of multiple string switcheshttps://sourceforge.net/p/cmdlineparser/bugs/4/<div class="markdown_content"><p>When trying to parse</p> <p>app.exe -a "aaa" -b "bbb"</p> <p>the value of switch a becomes</p> <p>aaa" -b "bbb</p> <p>This is caused by an incorrect regex in the function initialise in class StringSwitch. The line</p> <p>this.valuePattern = @")((?:"")(?&lt;value&gt;.+)(?:"")|(?&lt;value&gt;\S+))";</p> <p>should be replaced with</p> <p>this.valuePattern = @")((?:"")(?&lt;value&gt;[^""]+)(?:"")|(?&lt;value&gt;\S+))";</p> <p>EJ</p></div>AnonymousSat, 01 Dec 2007 12:01:39 -0000https://sourceforge.net797981e8802df55574a52eaef03dd96ca45429aeAquileo | Suggestions for .NET 2.0 versionhttps://sourceforge.net/p/cmdlineparser/bugs/3/<div class="markdown_content"><p>Some suggestions for the a .NET 2.0 version:</p> <p>public static T GetOptions&lt;T&gt;() where T : new()<br /> {<br /> return GetOptions&lt;T&gt;(System.Environment.CommandLine);<br /> }</p> <p>public static T GetOptions&lt;T&gt;(string commandLine) where T : new()<br /> {<br /> return GetOptions&lt;T&gt;(commandLine, true);<br /> }</p> <p>public static T GetOptions&lt;T&gt;(string commandLine, bool includesProgramName) where T : new()<br /> {<br /> T result = new T();</p> <p>CommandLineParser parser = new CommandLineParser(result);<br /> parser.Parse(commandLine, includesProgramName);</p> <p>return result;<br /> }</p> <p>public static string GetCommandLine()<br /> {<br /> return System.Environment.CommandLine;<br /> }</p> <p>public static string GetUsage&lt;T&gt;() where T : new()<br /> {<br /> T result = new T();</p> <p>CommandLineParser parser = new CommandLineParser(result);<br /> parser.Parse(System.Environment.CommandLine, true);</p> <p>return parser.Usage;<br /> }</p> <p>public static string GetExplicitOptions&lt;T&gt;() where T : new()<br /> {<br /> T result = new T();</p> <p>CommandLineParser parser = new CommandLineParser(result);<br /> parser.Parse(System.Environment.CommandLine, true);</p> <p>return parser.ExplicitOptions;<br /> }</p></div>AnonymousMon, 08 Oct 2007 12:36:34 -0000https://sourceforge.net962f2192d43933745c155ef6e7115d37b6874ca5Aquileo | Incorrect constructor Parsehttps://sourceforge.net/p/cmdlineparser/bugs/2/<div class="markdown_content"><p>The constructor public void Parse(string[] args) does not take into account arguments containing spaces. A more correct solution is:</p> <p>public void Parse(string[] args)<br /> {<br /> string commandLine = "";<br /> foreach (string arg in args)<br /> {<br /> if (commandLine.Length &gt; 0)<br /> {<br /> commandLine += " ";<br /> }<br /> if (!String.IsNullOrEmpty(arg) &amp;&amp; arg.Contains(" "))<br /> {<br /> commandLine += "\"" + arg + "\"";<br /> }<br /> else<br /> {<br /> commandLine += arg;<br /> }<br /> }</p> <p>Probably this leads to problems</p></div>AnonymousMon, 08 Oct 2007 12:35:49 -0000https://sourceforge.netf000f936d60f85216b8a9458d7d2fcc5d02045f9Aquileo | Incorrect parsing of commandlinehttps://sourceforge.net/p/cmdlineparser/bugs/1/<div class="markdown_content"><p>Commandlines like</p> <p>"C:\path with space\program.exe" -k "text with space"</p> <p>are parsed incorrectly.</p> <p>The crulpit is in CommandLineParser.trimOffApplicationName. Changing the regex from</p> <p>@"^(?&lt;commandLine&gt;("".+""|(\S)+))(?&lt;remainder&gt;.+)"</p> <p>to</p> <p>@"^(?&lt;commandLine&gt;(""(^"")+""|(\S)+))(?&lt;remainder&gt;.+)"</p> <p>solves this problem.</p></div>AnonymousMon, 08 Oct 2007 12:30:29 -0000https://sourceforge.nete4c6d5f33c7512eb9a8f54f403448d22f9601557