feat(cli): Added support for listing Sonarr queued events

This commit is contained in:
2024-11-19 12:03:19 -07:00
parent 6b64b5ecc4
commit 2876913f48
2 changed files with 14 additions and 1 deletions
+5
View File
@@ -46,6 +46,8 @@ pub enum SonarrListCommand {
}, },
#[command(about = "List all Sonarr quality profiles")] #[command(about = "List all Sonarr quality profiles")]
QualityProfiles, QualityProfiles,
#[command(about = "List all queued events")]
QueuedEvents,
#[command(about = "List all series in your Sonarr library")] #[command(about = "List all series in your Sonarr library")]
Series, Series,
} }
@@ -111,6 +113,9 @@ impl<'a, 'b> CliCommandHandler<'a, 'b, SonarrListCommand> for SonarrListCommandH
SonarrListCommand::QualityProfiles => { SonarrListCommand::QualityProfiles => {
execute_network_event!(self, SonarrEvent::GetQualityProfiles); execute_network_event!(self, SonarrEvent::GetQualityProfiles);
} }
SonarrListCommand::QueuedEvents => {
execute_network_event!(self, SonarrEvent::GetQueuedEvents);
}
SonarrListCommand::Series => { SonarrListCommand::Series => {
execute_network_event!(self, SonarrEvent::ListSeries); execute_network_event!(self, SonarrEvent::ListSeries);
} }
+9 -1
View File
@@ -24,7 +24,14 @@ mod tests {
#[rstest] #[rstest]
fn test_list_commands_have_no_arg_requirements( fn test_list_commands_have_no_arg_requirements(
#[values("blocklist", "series", "downloads", "quality-profiles", "indexers")] #[values(
"blocklist",
"series",
"downloads",
"quality-profiles",
"indexers",
"queued-events"
)]
subcommand: &str, subcommand: &str,
) { ) {
let result = Cli::command().try_get_matches_from(["managarr", "sonarr", "list", subcommand]); let result = Cli::command().try_get_matches_from(["managarr", "sonarr", "list", subcommand]);
@@ -106,6 +113,7 @@ mod tests {
#[case(SonarrListCommand::Downloads, SonarrEvent::GetDownloads)] #[case(SonarrListCommand::Downloads, SonarrEvent::GetDownloads)]
#[case(SonarrListCommand::Indexers, SonarrEvent::GetIndexers)] #[case(SonarrListCommand::Indexers, SonarrEvent::GetIndexers)]
#[case(SonarrListCommand::QualityProfiles, SonarrEvent::GetQualityProfiles)] #[case(SonarrListCommand::QualityProfiles, SonarrEvent::GetQualityProfiles)]
#[case(SonarrListCommand::QueuedEvents, SonarrEvent::GetQueuedEvents)]
#[case(SonarrListCommand::Series, SonarrEvent::ListSeries)] #[case(SonarrListCommand::Series, SonarrEvent::ListSeries)]
#[tokio::test] #[tokio::test]
async fn test_handle_list_command( async fn test_handle_list_command(