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/Console/Commands/ConfigListLocalCommand.cs

35 lines
1.0 KiB

using System.ComponentModel;
using System.Diagnostics.CodeAnalysis;
using JetBrains.Annotations;
using Recyclarr.Cli.Processors.Config;
using Recyclarr.Config.Parsing.ErrorHandling;
using Recyclarr.Repo;
using Spectre.Console.Cli;
namespace Recyclarr.Cli.Console.Commands;
[UsedImplicitly]
[Description("List local configuration files.")]
public class ConfigListLocalCommand(ILogger log, ConfigListLocalProcessor processor, IMultiRepoUpdater repoUpdater)
: AsyncCommand<ConfigListLocalCommand.CliSettings>
{
[SuppressMessage("Design", "CA1034:Nested types should not be visible")]
public class CliSettings : BaseCommandSettings;
public override async Task<int> ExecuteAsync(CommandContext context, CliSettings settings)
{
try
{
await repoUpdater.UpdateAllRepositories(settings.CancellationToken);
processor.Process();
return 0;
}
catch (NoConfigurationFilesException)
{
log.Error("No configuration files found");
}
return 1;
}
}