feat(cli): Support for testing an individual Sonarr indexer

This commit is contained in:
2024-11-22 17:22:41 -07:00
parent 2dce587ea8
commit 68830a8789
2 changed files with 63 additions and 0 deletions
+14
View File
@@ -90,6 +90,13 @@ pub enum SonarrCommand {
)]
task_name: SonarrTaskName,
},
#[command(
about = "Test the indexer with the given ID. Note that a successful test returns an empty JSON body; i.e. '{}'"
)]
TestIndexer {
#[arg(long, help = "The ID of the indexer to test", required = true)]
indexer_id: i64,
},
}
impl From<SonarrCommand> for Command {
@@ -185,6 +192,13 @@ impl<'a, 'b> CliCommandHandler<'a, 'b, SonarrCommand> for SonarrCliHandler<'a, '
.await?;
serde_json::to_string_pretty(&resp)?
}
SonarrCommand::TestIndexer { indexer_id } => {
let resp = self
.network
.handle_network_event(SonarrEvent::TestIndexer(Some(indexer_id)).into())
.await?;
serde_json::to_string_pretty(&resp)?
}
};
Ok(result)