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