feat(cli): Support for listing all Sonarr tasks
This commit is contained in:
@@ -57,7 +57,7 @@ pub enum RadarrListCommand {
|
|||||||
RootFolders,
|
RootFolders,
|
||||||
#[command(about = "List all Radarr tags")]
|
#[command(about = "List all Radarr tags")]
|
||||||
Tags,
|
Tags,
|
||||||
#[command(about = "List tasks")]
|
#[command(about = "List all Radarr tasks")]
|
||||||
Tasks,
|
Tasks,
|
||||||
#[command(about = "List all Radarr updates")]
|
#[command(about = "List all Radarr updates")]
|
||||||
Updates,
|
Updates,
|
||||||
|
|||||||
@@ -78,6 +78,8 @@ pub enum SonarrListCommand {
|
|||||||
},
|
},
|
||||||
#[command(about = "List all Sonarr tags")]
|
#[command(about = "List all Sonarr tags")]
|
||||||
Tags,
|
Tags,
|
||||||
|
#[command(about = "List all Sonarr tasks")]
|
||||||
|
Tasks,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<SonarrListCommand> for Command {
|
impl From<SonarrListCommand> for Command {
|
||||||
@@ -215,6 +217,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::Tasks => {
|
||||||
|
let resp = self
|
||||||
|
.network
|
||||||
|
.handle_network_event(SonarrEvent::GetTasks.into())
|
||||||
|
.await?;
|
||||||
|
serde_json::to_string_pretty(&resp)?
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
Ok(result)
|
Ok(result)
|
||||||
|
|||||||
@@ -33,7 +33,8 @@ mod tests {
|
|||||||
"indexers",
|
"indexers",
|
||||||
"queued-events",
|
"queued-events",
|
||||||
"root-folders",
|
"root-folders",
|
||||||
"tags"
|
"tags",
|
||||||
|
"tasks"
|
||||||
)]
|
)]
|
||||||
subcommand: &str,
|
subcommand: &str,
|
||||||
) {
|
) {
|
||||||
@@ -206,6 +207,7 @@ mod tests {
|
|||||||
#[case(SonarrListCommand::RootFolders, SonarrEvent::GetRootFolders)]
|
#[case(SonarrListCommand::RootFolders, SonarrEvent::GetRootFolders)]
|
||||||
#[case(SonarrListCommand::Series, SonarrEvent::ListSeries)]
|
#[case(SonarrListCommand::Series, SonarrEvent::ListSeries)]
|
||||||
#[case(SonarrListCommand::Tags, SonarrEvent::GetTags)]
|
#[case(SonarrListCommand::Tags, SonarrEvent::GetTags)]
|
||||||
|
#[case(SonarrListCommand::Tasks, SonarrEvent::GetTasks)]
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
async fn test_handle_list_command(
|
async fn test_handle_list_command(
|
||||||
#[case] list_command: SonarrListCommand,
|
#[case] list_command: SonarrListCommand,
|
||||||
|
|||||||
Reference in New Issue
Block a user