-
-
Couldn't load subscription status.
- Fork 0
How to Use (The Builder Approach)
Iuga Alexandru edited this page May 19, 2023
·
2 revisions
Commando offers support for three dependency injection frameworks:
Reference the nuget package corresponding to the dependency injection framework that you want to use.
ConsoleTools.Commando.Setup.AutofacConsoleTools.Commando.Setup.NinjectConsoleTools.Commando.Setup.Microsoft
In the Main method, use an ApplicationBuilder:
Application application = ApplicationBuilder.Create()
.RegisterCommandsFrom(typeof(DummyCommand).Assembly) // Provide here the assembly containing your commands.
.Build();
await application.RunAsync(args);[NamedCommand("read", Description = "Display the content of a text file.")]
internal class ReadCommand : ICommand
{
[NamedParameter("file", ShortName = 'f', Description = "The full path of the file.")]
public string FilePath { get; set; }
public Task Execute()
{
...
}
}