Multiple Command classes

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

Hi,

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

Coordinator
Nov 29, 2011 at 8:12 PM

Please show an example how the interface should work.

Dec 3, 2011 at 12:37 PM

Hi,

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

Coordinator
Dec 4, 2011 at 8: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.