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

This commit is contained in:
Dark-Alex-17 committed 2026-08-20 22:06:23 -06:00
1 parent de41d6fef7
commit 1d8ccd7ff6
4 files changed
+125 -2

No files matched your search

+9
View File
@@ -35,6 +35,8 @@ pub enum ReadarrListCommand {
QualityProfiles,
#[command(about = "List all queued events")]
QueuedEvents,
#[command(about = "List all Readarr tags")]
Tags,
#[command(about = "List all Readarr tasks")]
Tasks,
#[command(about = "List all Readarr updates")]
@@ -113,6 +115,13 @@ impl<'a, 'b> CliCommandHandler<'a, 'b, ReadarrListCommand> for ReadarrListComman
.await?;
serde_json::to_string_pretty(&resp)?
}
ReadarrListCommand::Tags => {
let resp = self
.network
.handle_network_event(ReadarrEvent::GetTags.into())
.await?;
serde_json::to_string_pretty(&resp)?
}
ReadarrListCommand::Tasks => {
let resp = self
.network
@@ -30,6 +30,7 @@ mod tests {
"metadata-profiles",
"quality-profiles",
"queued-events",
"tags",
"tasks",
"updates"
)]
@@ -241,6 +242,28 @@ mod tests {
assert_ok!(&result);
}
#[tokio::test]
async fn test_handle_list_tags_command() {
let mut mock_network = MockNetworkTrait::new();
mock_network
.expect_handle_network_event()
.with(eq::<NetworkEvent>(ReadarrEvent::GetTags.into()))
.times(1)
.returning(|_| {
Ok(Serdeable::Readarr(ReadarrSerdeable::Value(
json!({"testResponse": "response"}),
)))
});
let app_arc = Arc::new(Mutex::new(App::test_default()));
let list_tags_command = ReadarrListCommand::Tags;
let result = ReadarrListCommandHandler::with(&app_arc, list_tags_command, &mut mock_network)
.handle()
.await;
assert_ok!(&result);
}
#[tokio::test]
async fn test_handle_list_tasks_command() {
let mut mock_network = MockNetworkTrait::new();