feat(readarr): fetch all indexers and expose them on the CLI

This commit is contained in:
Dark-Alex-17 committed 2026-09-01 16:59:57 -06:00
1 parent c94b2a40d0
commit be5826f2c4
7 files changed
+218 -2

No files matched your search

+9
View File
@@ -93,6 +93,8 @@ pub enum ReadarrListCommand {
#[arg(long, help = "How many history events to fetch", default_value_t = 500)]
events: u64,
},
#[command(about = "List all Readarr indexers")]
Indexers,
#[command(about = "Fetch Readarr logs")]
Logs {
#[arg(long, help = "How many log events to fetch", default_value_t = 500)]
@@ -233,6 +235,13 @@ impl<'a, 'b> CliCommandHandler<'a, 'b, ReadarrListCommand> for ReadarrListComman
.await?;
serde_json::to_string_pretty(&resp)?
}
ReadarrListCommand::Indexers => {
let resp = self
.network
.handle_network_event(ReadarrEvent::GetIndexers.into())
.await?;
serde_json::to_string_pretty(&resp)?
}
ReadarrListCommand::Logs {
events,
output_in_log_format,
@@ -29,6 +29,7 @@ mod tests {
"authors",
"blocklist",
"disk-space",
"indexers",
"metadata-profiles",
"quality-profiles",
"queued-events",
@@ -656,6 +657,29 @@ mod tests {
assert_ok!(&result);
}
#[tokio::test]
async fn test_handle_list_indexers_command() {
let mut mock_network = MockNetworkTrait::new();
mock_network
.expect_handle_network_event()
.with(eq::<NetworkEvent>(ReadarrEvent::GetIndexers.into()))
.times(1)
.returning(|_| {
Ok(Serdeable::Readarr(ReadarrSerdeable::Value(
json!({"testResponse": "response"}),
)))
});
let app_arc = Arc::new(Mutex::new(App::test_default()));
let list_indexers_command = ReadarrListCommand::Indexers;
let result =
ReadarrListCommandHandler::with(&app_arc, list_indexers_command, &mut mock_network)
.handle()
.await;
assert_ok!(&result);
}
#[tokio::test]
async fn test_handle_list_logs_command() {
let expected_events = 1000;