Parsing the Command Line

One of the not-so-nice things about writing Command Line applications is that you somehow have to parse the command line. Up until now, I have been using CSharpOptParse, which does the job nicely, but has the drawback of either creating a dependency on the CSharpOptParse.dll, or keeping the license terms in mind. Luckily, this was changed a year ago from GPL to Apache License 2.0, which is a very lenient license.

But nevertheless, it is still overkill for my purposes, and some functionality of CSharpOptParse is not very useful in my opinion. For example, it includes a mechanism to automatically display Usage Information (through the UsageBuilder), but I do not really like the output.

I have started to create a little place for misc. code samples on this site, and one of these samples is a simple command line parser that turns the args string-array into a dictionary. It’s nowhere near as flexible as CSharpOptParse, but it’s good enough for my uses. I have updated MakeDDF to version 1.0.1, with the only change being the change of the command line parser so that it does not require a separate DLL anymore. I will do the same in the next release of the Command Line Tools, which may take a few more weeks though.

One thought to “Parsing the Command Line”

Leave a Reply

Your email address will not be published. Required fields are marked *