feat(readarr): fetch Readarr updates and expose them on the CLI

Adds ReadarrEvent::GetUpdates backed by get_readarr_updates, rendering the
update history into the Readarr updates view, and surfaces it as
'readarr list updates'.

Covers the case where an update record omits the changes key, which the
live instance returns for its most recent release.
This commit is contained in:
Dark-Alex-17 committed 2026-08-20 21:22:31 -06:00
1 parent e0e82e654e
commit c6d729162a
6 files changed
+225 -3

No files matched your search

+9
View File
@@ -19,6 +19,8 @@ mod list_command_handler_tests;
pub enum ReadarrListCommand {
#[command(about = "List disk space details for all provisioned root folders in Readarr")]
DiskSpace,
#[command(about = "List all Readarr updates")]
Updates,
}
impl From<ReadarrListCommand> for Command {
@@ -55,6 +57,13 @@ impl<'a, 'b> CliCommandHandler<'a, 'b, ReadarrListCommand> for ReadarrListComman
.await?;
serde_json::to_string_pretty(&resp)?
}
ReadarrListCommand::Updates => {
let resp = self
.network
.handle_network_event(ReadarrEvent::GetUpdates.into())
.await?;
serde_json::to_string_pretty(&resp)?
}
};
Ok(result)
+26 -1
View File
@@ -23,7 +23,9 @@ mod tests {
use super::*;
#[rstest]
fn test_list_commands_have_no_arg_requirements(#[values("disk-space")] subcommand: &str) {
fn test_list_commands_have_no_arg_requirements(
#[values("disk-space", "updates")] subcommand: &str,
) {
let result = Cli::command().try_get_matches_from(["managarr", "readarr", "list", subcommand]);
assert_ok!(&result);
@@ -69,5 +71,28 @@ mod tests {
assert_ok!(&result);
}
#[tokio::test]
async fn test_handle_list_updates_command() {
let mut mock_network = MockNetworkTrait::new();
mock_network
.expect_handle_network_event()
.with(eq::<NetworkEvent>(ReadarrEvent::GetUpdates.into()))
.times(1)
.returning(|_| {
Ok(Serdeable::Readarr(ReadarrSerdeable::Value(
json!({"testResponse": "response"}),
)))
});
let app_arc = Arc::new(Mutex::new(App::test_default()));
let list_updates_command = ReadarrListCommand::Updates;
let result =
ReadarrListCommandHandler::with(&app_arc, list_updates_command, &mut mock_network)
.handle()
.await;
assert_ok!(&result);
}
}
}