diff --git a/src/FilterLists.Agent/CommandLineOptions.cs b/src/FilterLists.Agent/CommandLineOptions.cs index 7a5c38293..8e2c3aee6 100644 --- a/src/FilterLists.Agent/CommandLineOptions.cs +++ b/src/FilterLists.Agent/CommandLineOptions.cs @@ -15,5 +15,10 @@ public CommandLineOptions(bool archiveLists, bool validateUrls) [Option('v', "validate", Required = false, HelpText = "Validate all URLs in the FilterLists database.")] public bool ValidateUrls { get; } + + public bool Any() + { + return ArchiveLists || ValidateUrls; + } } } \ No newline at end of file diff --git a/src/FilterLists.Agent/Program.cs b/src/FilterLists.Agent/Program.cs index 0644fdde5..3742ae124 100644 --- a/src/FilterLists.Agent/Program.cs +++ b/src/FilterLists.Agent/Program.cs @@ -17,13 +17,16 @@ public static async Task Main(string[] args) { _serviceProvider = ServiceProviderBuilder.Build(); var parser = _serviceProvider.GetService(); - var mediator = _serviceProvider.GetService(); await parser.ParseArguments(args).MapResult(async o => { - if (o.ArchiveLists) - await mediator.Send(new ArchiveLists.Command()); - if (o.ValidateUrls) - await mediator.Send(new ValidateAllUrls.Command()); + if (o.Any()) + { + var mediator = _serviceProvider.GetService(); + if (o.ArchiveLists) + await mediator.Send(new ArchiveLists.Command()); + if (o.ValidateUrls) + await mediator.Send(new ValidateAllUrls.Command()); + } }, e => Task.FromResult(0) );