Skip to content

How to customize the parser

Matthias GROSPERRIN edited this page Oct 24, 2015 · 1 revision

MGR.CommandLineParser offers four main extensibility points:

  • MGR.CommandLineParser.IConsole: change the way the parser logs information to the user (by default, use System.Console). Learn more
  • MGR.CommandLineParser.Converters.IConverter: used by the parser to convert the argument from the command line (as string) to the type of the option. Some converters are built-in (and known by the parser) but you can build your own to remplace existing one or convert unsupported types. Learn more
  • MGR.CommandLineParser.ICommandTypeProvider: used by the parser to retrieve all types of command. By default, the commands are retrieved by filtering all types implementing MGR.CommandLineParser.Command.ICommand in all assemblies located in the current directory and the ones already loaded in the current AppDomain. Learn more
  • MGR.CommandLineParser.ICommandActivator: used by the parser to create a instance of a command. By default, the default constructor are called (using Activator.CreateInstance). Learn more

To change the implementation of these interfaces, use the dependency resolver.