diff --git a/CHANGELOG.md b/CHANGELOG.md index 21e63461..f237c65f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -21,6 +21,7 @@ changes you may need to make. ### Removed - **BREAKING**: Array-style instances are no longer supported. +- **BREAKING**: Remove deprecated CLI commands: `radarr`, `sonarr`, and `create-config`. ## [4.4.1] - 2023-04-08 diff --git a/src/Recyclarr.Cli/Console/CliSetup.cs b/src/Recyclarr.Cli/Console/CliSetup.cs index 4e27b633..b7dca9c0 100644 --- a/src/Recyclarr.Cli/Console/CliSetup.cs +++ b/src/Recyclarr.Cli/Console/CliSetup.cs @@ -28,11 +28,5 @@ public static class CliSetup config.AddCommand("create"); config.AddCommand("list"); }); - - // LEGACY / DEPRECATED SUBCOMMANDS - cli.AddCommand("radarr"); - cli.AddCommand("sonarr"); - cli.AddCommand("create-config") - .WithDescription("OBSOLETE: Use `config create` instead"); } } diff --git a/src/Recyclarr.Cli/Console/Commands/ConfigCreateCommand.cs b/src/Recyclarr.Cli/Console/Commands/ConfigCreateCommand.cs index 413d752b..9bc91bf0 100644 --- a/src/Recyclarr.Cli/Console/Commands/ConfigCreateCommand.cs +++ b/src/Recyclarr.Cli/Console/Commands/ConfigCreateCommand.cs @@ -32,11 +32,6 @@ public class ConfigCreateCommand : AsyncCommand public override async Task ExecuteAsync(CommandContext context, CliSettings settings) { - if (context.Name == "create-config") - { - _log.Warning("The `create-config` subcommand is DEPRECATED -- Use `config create` instead!"); - } - try { await _processor.Process(settings.Path); diff --git a/src/Recyclarr.Cli/Console/Commands/RadarrCommand.cs b/src/Recyclarr.Cli/Console/Commands/RadarrCommand.cs deleted file mode 100644 index 51be51c6..00000000 --- a/src/Recyclarr.Cli/Console/Commands/RadarrCommand.cs +++ /dev/null @@ -1,99 +0,0 @@ -using System.ComponentModel; -using System.Diagnostics.CodeAnalysis; -using System.IO.Abstractions; -using JetBrains.Annotations; -using Recyclarr.Cli.Console.Helpers; -using Recyclarr.Cli.Console.Settings; -using Recyclarr.Cli.Migration; -using Recyclarr.Cli.Pipelines.CustomFormat.Guide; -using Recyclarr.Cli.Pipelines.QualitySize.Guide; -using Recyclarr.Cli.Processors; -using Recyclarr.TrashLib.Config; -using Recyclarr.TrashLib.Repo; -using Spectre.Console.Cli; - -namespace Recyclarr.Cli.Console.Commands; - -[UsedImplicitly] -[Description("OBSOLETE: Use `sync radarr` instead")] -internal class RadarrCommand : AsyncCommand -{ - private readonly ILogger _log; - private readonly CustomFormatDataLister _cfLister; - private readonly QualitySizeDataLister _qualityLister; - private readonly IMigrationExecutor _migration; - private readonly IRepoUpdater _repoUpdater; - private readonly ISyncProcessor _syncProcessor; - - [UsedImplicitly] - [SuppressMessage("Design", "CA1034:Nested types should not be visible")] - public class CliSettings : ServiceCommandSettings, ISyncSettings - { - public SupportedServices? Service => SupportedServices.Radarr; - public IReadOnlyCollection Instances { get; } = Array.Empty(); - - [CommandOption("-p|--preview")] - [Description("Only display the processed markdown results without making any API calls.")] - [UsedImplicitly(ImplicitUseKindFlags.Assign)] - public bool Preview { get; init; } - - [CommandOption("-c|--config")] - [Description( - "One or more YAML config files to use. All configs will be used and settings are additive. " + - "If not specified, the script will look for `recyclarr.yml` in the same directory as the executable.")] - [UsedImplicitly(ImplicitUseKindFlags.Assign)] - [TypeConverter(typeof(FileInfoConverter))] - public IFileInfo[] ConfigsOption { get; init; } = Array.Empty(); - public IReadOnlyCollection Configs => ConfigsOption; - - [CommandOption("--list-custom-formats")] - [Description("List available custom formats from the guide in YAML format.")] - [UsedImplicitly(ImplicitUseKindFlags.Assign)] - public bool ListCustomFormats { get; init; } - - [CommandOption("--list-qualities")] - [Description("List available quality definition types from the guide.")] - [UsedImplicitly(ImplicitUseKindFlags.Assign)] - public bool ListQualities { get; init; } - } - - public RadarrCommand( - ILogger log, - CustomFormatDataLister cfLister, - QualitySizeDataLister qualityLister, - IMigrationExecutor migration, - IRepoUpdater repoUpdater, - ISyncProcessor syncProcessor) - { - _log = log; - _cfLister = cfLister; - _qualityLister = qualityLister; - _migration = migration; - _repoUpdater = repoUpdater; - _syncProcessor = syncProcessor; - } - - public override async Task ExecuteAsync(CommandContext context, CliSettings settings) - { - // Will throw if migration is required, otherwise just a warning is issued. - _migration.CheckNeededMigrations(); - await _repoUpdater.UpdateRepo(); - - if (settings.ListCustomFormats) - { - _log.Warning("The `radarr` subcommand is DEPRECATED -- Use `list custom-formats radarr` instead!"); - _cfLister.ListCustomFormats(SupportedServices.Radarr); - return 0; - } - - if (settings.ListQualities) - { - _log.Warning("The `radarr` subcommand is DEPRECATED -- Use `list qualities radarr` instead!"); - _qualityLister.ListQualities(SupportedServices.Radarr); - return 0; - } - - _log.Warning("The `radarr` subcommand is DEPRECATED -- Use `sync` instead!"); - return (int) await _syncProcessor.ProcessConfigs(settings); - } -} diff --git a/src/Recyclarr.Cli/Console/Commands/SonarrCommand.cs b/src/Recyclarr.Cli/Console/Commands/SonarrCommand.cs deleted file mode 100644 index 1dcaa0a3..00000000 --- a/src/Recyclarr.Cli/Console/Commands/SonarrCommand.cs +++ /dev/null @@ -1,130 +0,0 @@ -using System.ComponentModel; -using System.Diagnostics.CodeAnalysis; -using System.IO.Abstractions; -using JetBrains.Annotations; -using Recyclarr.Cli.Console.Helpers; -using Recyclarr.Cli.Console.Settings; -using Recyclarr.Cli.Migration; -using Recyclarr.Cli.Pipelines.CustomFormat.Guide; -using Recyclarr.Cli.Pipelines.QualitySize.Guide; -using Recyclarr.Cli.Pipelines.ReleaseProfile.Guide; -using Recyclarr.Cli.Processors; -using Recyclarr.TrashLib.Config; -using Recyclarr.TrashLib.Repo; -using Spectre.Console.Cli; - -namespace Recyclarr.Cli.Console.Commands; - -[UsedImplicitly] -[Description("OBSOLETE: Use `sync sonarr` instead")] -internal class SonarrCommand : AsyncCommand -{ - private readonly ILogger _log; - private readonly CustomFormatDataLister _cfLister; - private readonly QualitySizeDataLister _qualityLister; - private readonly ReleaseProfileDataLister _rpLister; - private readonly IMigrationExecutor _migration; - private readonly IRepoUpdater _repoUpdater; - private readonly ISyncProcessor _syncProcessor; - - [UsedImplicitly] - [SuppressMessage("Design", "CA1034:Nested types should not be visible")] - public class CliSettings : ServiceCommandSettings, ISyncSettings - { - public SupportedServices? Service => SupportedServices.Sonarr; - public IReadOnlyCollection Instances { get; } = Array.Empty(); - - [CommandOption("-p|--preview")] - [Description("Only display the processed markdown results without making any API calls.")] - [UsedImplicitly(ImplicitUseKindFlags.Assign)] - public bool Preview { get; init; } - - [CommandOption("-c|--config")] - [Description( - "One or more YAML config files to use. All configs will be used and settings are additive. " + - "If not specified, the script will look for `recyclarr.yml` in the same directory as the executable.")] - [UsedImplicitly(ImplicitUseKindFlags.Assign)] - [TypeConverter(typeof(FileInfoConverter))] - public IFileInfo[] ConfigsOption { get; init; } = Array.Empty(); - public IReadOnlyCollection Configs => ConfigsOption; - - [CommandOption("--list-custom-formats")] - [Description("List available custom formats from the guide in YAML format.")] - [UsedImplicitly(ImplicitUseKindFlags.Assign)] - public bool ListCustomFormats { get; init; } - - [CommandOption("--list-qualities")] - [Description("List available quality definition types from the guide.")] - [UsedImplicitly(ImplicitUseKindFlags.Assign)] - public bool ListQualities { get; init; } - - [CommandOption("--list-release-profiles")] - [Description("List available release profiles from the guide in YAML format.")] - [UsedImplicitly(ImplicitUseKindFlags.Assign)] - public bool ListReleaseProfiles { get; init; } - - // The default value is "empty" because I need to know when the user specifies the option but no value with it. - // Discussed here: https://github.com/Tyrrrz/CliFx/discussions/128#discussioncomment-2647015 - [CommandOption("--list-terms")] - [UsedImplicitly(ImplicitUseKindFlags.Assign)] - [Description( - "For the given Release Profile Trash ID, list terms in it that can be filtered in YAML format. " + - "Note that not every release profile has terms that may be filtered.")] - public string? ListTerms { get; init; } - } - - public SonarrCommand( - ILogger log, - CustomFormatDataLister cfLister, - QualitySizeDataLister qualityLister, - ReleaseProfileDataLister rpLister, - IMigrationExecutor migration, - IRepoUpdater repoUpdater, - ISyncProcessor syncProcessor) - { - _log = log; - _cfLister = cfLister; - _qualityLister = qualityLister; - _rpLister = rpLister; - _migration = migration; - _repoUpdater = repoUpdater; - _syncProcessor = syncProcessor; - } - - public override async Task ExecuteAsync(CommandContext context, CliSettings settings) - { - // Will throw if migration is required, otherwise just a warning is issued. - _migration.CheckNeededMigrations(); - await _repoUpdater.UpdateRepo(); - - if (settings.ListCustomFormats) - { - _log.Warning("The `sonarr` subcommand is DEPRECATED -- Use `list custom-formats sonarr` instead!"); - _cfLister.ListCustomFormats(SupportedServices.Sonarr); - return 0; - } - - if (settings.ListQualities) - { - _log.Warning("The `sonarr` subcommand is DEPRECATED -- Use `list qualities sonarr` instead!"); - _qualityLister.ListQualities(SupportedServices.Sonarr); - return 0; - } - - if (settings.ListReleaseProfiles) - { - _log.Warning("The `sonarr` subcommand is DEPRECATED -- Use `list release-profiles` instead!"); - _rpLister.ListReleaseProfiles(); - return 0; - } - - if (settings.ListTerms is not null) - { - _rpLister.ListTerms(settings.ListTerms); - return 0; - } - - _log.Warning("The `sonarr` subcommand is DEPRECATED -- Use `sync` instead!"); - return (int) await _syncProcessor.ProcessConfigs(settings); - } -}