Middleware for generating Crescendo PowerShell modules from .NET command line tools using System.CommandLine
You will need to map your commands to PowerShell cmdlets and add the Crescendo middleware.
commandLineBuilder.AddCrescendoMiddleware(opts =>
{
opts.AddCmdletMapping("Get-Message", rootCommand);
});
Once this is done, you can call your executable with --crescendo
.
.\ConsoleApp.exe --crescendo
A crescendo JSON file will be generated. Create your module with Crescendo.
Install-Module Microsoft.PowerShell.Crescendo
Export-CrescendoModule -ConfigurationFile ConsoleApp.crescendo.json -ModuleName ConsoleApp
You can then import that module and call the imported cmdlets.
PS> Import-Module .\ConsoleApp.psd1
PS> Get-Message -message test
--delay = 0
--message = Test