You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
recyclarr/src/Recyclarr.Cli/Processors/Config/ConfigCreationProcessor.cs

25 lines
666 B

using Recyclarr.Cli.Console.Settings;
namespace Recyclarr.Cli.Processors.Config;
public class ConfigCreationProcessor : IConfigCreationProcessor
{
private readonly IOrderedEnumerable<IConfigCreator> _creators;
public ConfigCreationProcessor(IOrderedEnumerable<IConfigCreator> creators)
{
_creators = creators;
}
public void Process(ICreateConfigSettings settings)
{
var creator = _creators.FirstOrDefault(x => x.CanHandle(settings));
if (creator is null)
{
throw new FatalException("Unable to determine which config creation logic to use");
}
creator.Create(settings);
}
}