feat: pretty-print checks and collapse runs to one line per commit
commit
cb61cacfeat: pretty-print checks and collapse runs to one line per commit
checks list now renders each Check with facet-pretty instead of a
hand-built string, so image and depends are visible. checks runs
now prints only the latest status per checked commit instead of every
historical Queued/Running/terminal transition.
Assisted-by: Claude:claude-sonnet-5
Reviews
No reviews of this commit yet — record a verdict below.
Start a review
Cargo.lock
@@ -1544,6 +1544,7 @@
dependencies = [
"crossterm",
"facet",
+ "facet-pretty",
"figue",
"form_urlencoded",
"futures-util",
Cargo.toml
@@ -46,6 +46,7 @@
clap_mangen = "0.2.31"
figue = "5.0.0-rc.5"
facet = { version = "0.50.0-rc.0", features = ["reflect"] }
+facet-pretty = "0.50.0-rc.5"
getrandom = "0.4"
facet-git-tree = { git = "https://github.com/git-ents/facet-git-tree" }
form_urlencoded = "1"
crates/git-ents/Cargo.toml
@@ -8,6 +8,7 @@
[dependencies]
crossterm = "0.29.0"
facet = { workspace = true }
+facet-pretty = { workspace = true }
figue = { workspace = true }
form_urlencoded.workspace = true
futures-util = { version = "0.3.32", default-features = false, features = ["sink", "std"] }
crates/git-ents/src/main.rs
@@ -17,6 +17,7 @@
use std::process::{Command, ExitCode, Stdio};
use facet::Facet;
+use facet_pretty::FacetPretty;
use figue::{self as args, FigueBuiltins};
use git_anchor::{LineRange, Projection};
use git_comment::{COMMENTS_NS, Comment};
@@ -348,8 +349,8 @@
}
}
-/// Print every recorded check run on `remote`, newest commit first and
-/// (within a commit) newest run first, as `<commit> <when> <check>=<status> …`.
+/// Print the latest recorded status of every checked commit on `remote`,
+/// newest commit first, as `<commit> <when> <check>=<status> …`.
fn checks_runs(remote: &str) -> Result<(), String> {
let repo = repo()?;
sync_namespace(remote, checks::RUNS_NS)?;
@@ -359,19 +360,20 @@
return Ok(());
}
for commit_runs in commits {
- for run in &commit_runs.runs {
- let when = ago(run.at);
- let results = run
- .results
- .iter()
- .map(|outcome| format!("{}={}", outcome.name, outcome.status))
- .collect::<Vec<_>>()
- .join(" ");
- println!(
- "{} {when} {results}",
- short_id(&commit_runs.commit.to_string())
- );
- }
+ let Some(run) = commit_runs.runs.first() else {
+ continue;
+ };
+ let when = ago(run.at);
+ let results = run
+ .results
+ .iter()
+ .map(|outcome| format!("{}={}", outcome.name, outcome.status))
+ .collect::<Vec<_>>()
+ .join(" ");
+ println!(
+ "{} {when} {results}",
+ short_id(&commit_runs.commit.to_string())
+ );
}
Ok(())
}
@@ -624,17 +626,7 @@
}
fn value(item: &Check) -> String {
- let mut value = item
- .command
- .clone()
- .unwrap_or_else(|| "(composite)".to_owned());
- if let Some(image) = &item.image {
- value.push_str(&format!(" [image: {image}]"));
- }
- if !item.depends.is_empty() {
- value.push_str(&format!(" [needs: {}]", item.depends.join(", ")));
- }
- value
+ item.pretty().to_string()
}
}