Hi... I used your library in the development of a recent command-line application... works very nicely.
I have a suggestion regarding the exposure of the FoundDefinitions as public. I had the need to perform operations based on the order in which the arguments were specified on the command line. For instance, my command line could be the following:
dvcontroller.exe --rewindAndWait --capture mjj.avi --rewind
In this example, I needed to execute a rewindAndWait process, and do a capture, and then submit a rewind process.
By exposing the FoundDefinitions information as public, I was able to iterate through them in order of execution. I know I could just access the command line arguments from the .NET framework, but the FoundDefinitions collection already contains the recognized command line arguments in the order specified, along with acompanying arguments with the respective argument (ie. mjj.avi for the --capture argument).
Here's how I modifed the library source code for my project (the mjj.sn, mjj.en, mjj.so, and mjj.eo monikers indicate the start of new code, end of new code, start of omitted code, and end of omitted code, respectively)...
In Parser.cs,
public string[] Parse(string[] args)
{
return Parse(this.OptStyle, this.UnixShortOption, this.DupOptHandleType,
this.UnknownOptHandleType, this.CaseSensitive, args);
}
// mjj.sn
private ArrayList foundDefinitions;
public ArrayList FoundDefinitions
{
get { return foundDefinitions; }
//set { foundDefinitions = value; }
}
// mjj.en
.
.
.
public string[] Parse(OptStyle optStyle, UnixShortOption unixShortOption,
DupOptHandleType dupOptHandleType, UnknownOptHandleType unknownOptHandleType,
bool caseSesitive, string[] args)
{
// mjj.so
//ArrayList foundDefinitions = new ArrayList();
// mjj.eo
// mjj.sn
foundDefinitions = new ArrayList();
// mjj.en
Group grp;
Match m;
Regex re;
StringCollection arguments;
bool isShort;
bool unknown;
string name;
string value;
string[] results;
}
I'm attaching my modified version of the file as well.
Just a suggestion... thanks for offering your library for public use.
Parser.cs