feat(cli): Support for listing Sonarr updates
This commit is contained in:
@@ -80,6 +80,8 @@ pub enum SonarrListCommand {
|
|||||||
Tags,
|
Tags,
|
||||||
#[command(about = "List all Sonarr tasks")]
|
#[command(about = "List all Sonarr tasks")]
|
||||||
Tasks,
|
Tasks,
|
||||||
|
#[command(about = "List all Sonarr updates")]
|
||||||
|
Updates,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<SonarrListCommand> for Command {
|
impl From<SonarrListCommand> for Command {
|
||||||
@@ -224,6 +226,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::Updates => {
|
||||||
|
let resp = self
|
||||||
|
.network
|
||||||
|
.handle_network_event(SonarrEvent::GetUpdates.into())
|
||||||
|
.await?;
|
||||||
|
serde_json::to_string_pretty(&resp)?
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
Ok(result)
|
Ok(result)
|
||||||
|
|||||||
@@ -34,7 +34,8 @@ mod tests {
|
|||||||
"queued-events",
|
"queued-events",
|
||||||
"root-folders",
|
"root-folders",
|
||||||
"tags",
|
"tags",
|
||||||
"tasks"
|
"tasks",
|
||||||
|
"updates"
|
||||||
)]
|
)]
|
||||||
subcommand: &str,
|
subcommand: &str,
|
||||||
) {
|
) {
|
||||||
@@ -208,6 +209,7 @@ mod tests {
|
|||||||
#[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)]
|
#[case(SonarrListCommand::Tasks, SonarrEvent::GetTasks)]
|
||||||
|
#[case(SonarrListCommand::Updates, SonarrEvent::GetUpdates)]
|
||||||
#[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