Multiple Command classes

Nov 29, 2011 at 7:31 PM
Edited Nov 29, 2011 at 7:32 PM


I have multiple commands I would like to dynamically (IoC) register (preferrably using parser.ExtractArgumentAttributes(mycommand)). In this case the first parameter of the passed arguments should define, which actual command is to be executed. If multiple commands are registered, ShowUsage() should show the list of possible commands.

Is there a way to implement this currently, or can you add this functionality?

regards, Tilli

Nov 29, 2011 at 9:12 PM

Please show an example how the interface should work.

Dec 3, 2011 at 1:37 PM


Public interface ICommand


String InvocationName { get; } //first parameter of the commandline

String Description{ get; } //eases globalization

Int Execute(); //returns the ErrorLevel to end with


If I register multiple commands to the CommandLineParser, it can print general help (my.exe, or my.exe /?, .etc), or help per Command (my.exe help SampleCommandName).

Regards, Tilli

Dec 4, 2011 at 9:12 AM

At this moment, this kind of usage is not supported. But the source code is available - you can extend it as you wish. I won't have time to work on the library in the near future.