CommandManager(Assembly, CommandOptions) Constructor

Initializes a new instance of the CommandManager class using the specified assembly.

Definition

Namespace: Ookii.CommandLine.Commands
Assembly: Ookii.CommandLine (in Ookii.CommandLine.dll) Version: 4.0.0+bb7ed9a8fdfd1cb21824750a8cf508863ad15086
C#
public CommandManager(
	Assembly assembly,
	CommandOptions? options = null
)

Parameters

assembly  Assembly
The assembly containing the commands.
options  CommandOptions  (Optional)
The options to use for parsing and usage help, or to use the default options.

Remarks

The CommandManager class will look in the specified assembly for any public classes that implement the ICommand interface, have the CommandAttribute attribute, and are not .

If assembly is the assembly that called this constructor, both public and internal command classes will be used. Otherwise, only public command classes are used.

This constructor uses reflection to determine which commands are available at runtime. To use source generation to locate commands at compile time, use the GeneratedCommandManagerAttribute attribute.

  Note

Once a command is created, the options instance may be modified with the options of the ParseOptionsAttribute attribute applied to the command class. Be aware of this if reusing the same CommandManager or CommandOptions instance to create multiple commands.

Exceptions

ArgumentNullExceptionassembly is .

See Also