Lines
60 %
Functions
25 %
Branches
100 %
use std::path::Path;
use cli_core::CommandError;
use rpc::references::{Report, check_references};
use sqlx::types::Uuid;
/// Prints the findings and the coverage; any finding fails the run.
fn conclude(report: &Report) -> Result<(), CommandError> {
report.findings().for_each(|finding| println!("{finding}"));
report.summary().iter().for_each(|line| println!("{line}"));
match report.findings().next() {
None => Ok(()),
Some(_) => Err(CommandError::Command(
"reference preflight failed".to_string(),
)),
}
pub async fn run(admin: Uuid, sources: Option<&Path>) -> Result<(), CommandError> {
let report = check_references(admin, sources)
.await
.map_err(|e| CommandError::Command(e.to_string()))?;
conclude(&report)
#[cfg(test)]
mod tests;