CommandManager(IEnumerableAssembly, CommandOptions) Constructor

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

Definition

Namespace: Ookii.CommandLine.Commands
Assembly: Ookii.CommandLine (in Ookii.CommandLine.dll) Version: 4.2.0+a4d3631e4dcc0970081ed435288efdebc1325f83
C#
public CommandManager(
	IEnumerable<Assembly> assemblies,
	CommandOptions? options = null
)

Parameters

assemblies  IEnumerableAssembly
The assemblies 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 assemblies for any public classes that implement the ICommand interface, have the CommandAttribute attribute, and are not .

If an assembly in assemblies is the assembly that called this constructor, both public and internal command classes will be used. For other assemblies, only public 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

ArgumentNullExceptionassemblies or one of its elements is .

See Also