Command Line Switch Parser
I didn't write it
(Peter Hallam did), but I was just using it and thought "wow, this is cool, it
needs to be found by more people!"
If you build console apps that take
multiple arguments (generate.exe /vroot:vbasic /target:c:\files\ ... etc.) then
this makes it very easy. To use it, just compile the provided code into a
library and reference from your own C#, VB.NET, etc. application.
From the readme;
Command
Line Argument Parser
----------------------------Author: peterhal@microsoft.com
Parsing command line arguments to a console
application is a common problem.
This library handles the common task of
reading arguments from a command line
and filling in the values in a
type.To use this library, define a class whose fields
represent the data that your
application wants to receive from arguments
on the command line. Then callUtilities.Utility.ParseCommandLineArguments() to fill the object with the
data
from the command line. Each field in the class defines a command line
argument.
The type of the field is used to validate the data read from the
command line.
The name of the field defines the name of the command line
option.The parser can handle fields of the following
types:- string
- int
- uint
- bool
-
enum
- array of the above type
Comments
- Anonymous
April 10, 2003
The comment has been removed - Anonymous
April 10, 2003
Hi Duncan,
I've commented about another way of doing this on my blog.
http://dotnetweblogs.com/nunitaddin - Anonymous
April 10, 2003
I'm pleased you liked it. ;) BTW have you had a chance to try NUnitAddin? I used it extensively when knocking together that code. It's one of those applications that's easy to dogfood...
See ya, Jamie. - Anonymous
April 10, 2003
The comment has been removed - Anonymous
April 10, 2003
Joel, the trick is not that I get a lot of traffic... but that content on my blog is much more likely to be found by a google search than in many other places. - Anonymous
April 13, 2003
http://www.sellsbrothers.com's Genghis project has an alternate approach I use when writing console app's. - Anonymous
March 23, 2004
The comment has been removed - Anonymous
June 28, 2004
The comment has been removed - Anonymous
June 28, 2004
I disagree. Shampoo is better. - Anonymous
June 28, 2004
Conditioner is better.