When building console applications that take parameters, you can use the arguments passed to Main(string[] args).
In the past I’ve simply indexed/looped that array and done a few regular expressions to extract the values. However, when the commands get more complicated, the parsing can get pretty ugly.
So I’m interested in:
- Libraries that you use
- Patterns that you use
Assume the commands always adhere to common standards such as answered here.
I would strongly suggest using NDesk.Options (Documentation) and/or Mono.Options (same API, different namespace). An example from the documentation: