feat(cli): Support for fetching all Sonarr root folders

This commit is contained in:
2024-11-21 16:39:20 -07:00
parent 16538a3158
commit bb1c08277e
2 changed files with 12 additions and 1 deletions
+9
View File
@@ -62,6 +62,8 @@ pub enum SonarrListCommand {
#[command(about = "List all queued events")] #[command(about = "List all queued events")]
QueuedEvents, QueuedEvents,
#[command(about = "List all series in your Sonarr library")] #[command(about = "List all series in your Sonarr library")]
#[command(about = "List all root folders in Sonarr")]
RootFolders,
Series, Series,
#[command(about = "Fetch all history events for the series with the given ID")] #[command(about = "Fetch all history events for the series with the given ID")]
SeriesHistory { SeriesHistory {
@@ -174,6 +176,13 @@ impl<'a, 'b> CliCommandHandler<'a, 'b, SonarrListCommand> for SonarrListCommandH
.await?; .await?;
serde_json::to_string_pretty(&resp)? serde_json::to_string_pretty(&resp)?
} }
SonarrListCommand::RootFolders => {
let resp = self
.network
.handle_network_event((SonarrEvent::GetRootFolders).into())
.await?;
serde_json::to_string_pretty(&resp)?
}
SonarrListCommand::Series => { SonarrListCommand::Series => {
let resp = self let resp = self
.network .network
+3 -1
View File
@@ -30,7 +30,8 @@ mod tests {
"downloads", "downloads",
"quality-profiles", "quality-profiles",
"indexers", "indexers",
"queued-events" "queued-events",
"root-folders"
)] )]
subcommand: &str, subcommand: &str,
) { ) {
@@ -199,6 +200,7 @@ mod tests {
#[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::QueuedEvents, SonarrEvent::GetQueuedEvents)]
#[case(SonarrListCommand::RootFolders, SonarrEvent::GetRootFolders)]
#[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(