feat: Dynamic command loader, default command with module registry
This commit is contained in:
25
Commands/Image/Module.cs
Normal file
25
Commands/Image/Module.cs
Normal file
@ -0,0 +1,25 @@
|
||||
using Automancer.Common;
|
||||
using Spectre.Console.Cli;
|
||||
|
||||
namespace Automancer.Command.Image;
|
||||
|
||||
public class Module : ICommandModuleWithRegistry
|
||||
{
|
||||
public void Configure(IConfigurator config)
|
||||
{
|
||||
// No implementation needed here
|
||||
}
|
||||
public void Configure(IConfigurator config, CommandRegistry registry)
|
||||
{
|
||||
config.AddBranch("image", image => {
|
||||
var description = "Docker/podman image operations";
|
||||
image.SetDescription(description);
|
||||
registry.Add("image", description);
|
||||
|
||||
image.AddCommand<BuildCommand>("build").WithDescription("Build a docker image");
|
||||
image.AddCommand<PushCommand>("push").WithDescription("Push a docker image");
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user