Saturday, 30 June 2007

Add Command Line Parsing to your applications

Sometimes you have some job to get done (e.g.: loading custom format text files in to a db) and you must be fast. So you take your favorite editor and write a script in your favorite scripting language. Next time that a similar problem comes to you, you edit the script making it more parametric.
For accomplish this task you can take two ways (not mutually exclusives):
  1. use command line parameters
  2. use a configuration file
If the script importance is growing you can evaluate a porting to .NET/Mono platform and use my Command Line Parsing Library to easy parse command line arguments. (The project was recenlty moved from GotDotNet to CodePlex).
For managing conifiguration data check out my Common Utility Library (but be careful, the software is experimental and can change very quickly disrupting backward compatibility).

My personal taste is to use command line options and I've used the Command Line Parsing Library for this purpose for more than two years. The project will grow, but I think that for now is quite stable.

No comments:

Post a Comment