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/ConfigListProcessor.cs

28 lines
811 B

using Autofac.Features.Indexed;
using Recyclarr.TrashLib.Config.Listers;
namespace Recyclarr.Cli.Processors.Config;
public class ConfigListProcessor
{
private readonly ILogger _log;
private readonly IIndex<ConfigCategory, IConfigLister> _configListers;
public ConfigListProcessor(ILogger log, IIndex<ConfigCategory, IConfigLister> configListers)
{
_log = log;
_configListers = configListers;
}
public void Process(ConfigCategory listCategory)
{
_log.Debug("Listing configuration for category {Category}", listCategory);
if (!_configListers.TryGetValue(listCategory, out var lister))
{
throw new ArgumentOutOfRangeException(nameof(listCategory), listCategory, "Unknown list category");
}
lister.List();
}
}