colored table
Some checks failed
continuous-integration/drone/push Build is failing

This commit is contained in:
Kasper Juul Hermansen 2023-01-10 22:33:11 +01:00
parent 06b673286a
commit f912217549
Signed by: kjuulh
GPG Key ID: 57B6E1465221F912
2 changed files with 16 additions and 11 deletions

View File

@ -19,13 +19,13 @@ impl Review {
Self { backend }
}
// Workflow
// 1. Fetch list of repos
// 2. Present menu
// 3. Choose begin quick review
// 4. Present pr and use delta to view changes
// 5. Approve, open, skip or quit
// 6. Repeat from 4
/// Workflow
/// 1. Fetch list of repos
/// 2. Present menu
/// 3. Choose begin quick review
/// 4. Present pr and use delta to view changes
/// 5. Approve, open, skip or quit
/// 6. Repeat from 4
fn run(&self, review_requested: Option<String>) -> eyre::Result<()> {
let prs = self.backend.get_prs(review_requested)?;
@ -42,13 +42,17 @@ impl Review {
.load_preset(UTF8_HORIZONTAL_ONLY)
.set_content_arrangement(comfy_table::ContentArrangement::Dynamic)
.set_header(vec![
Cell::new("repo"),
Cell::new("title"),
Cell::new("number"),
Cell::new("repo").add_attribute(comfy_table::Attribute::Bold),
Cell::new("title").add_attribute(comfy_table::Attribute::Bold),
Cell::new("number").add_attribute(comfy_table::Attribute::Bold),
])
.add_rows(prs.iter().map(|pr| {
let pr = pr.clone();
vec![pr.repository.name, pr.title, pr.number.to_string()]
vec![
Cell::new(pr.repository.name).fg(comfy_table::Color::Green),
Cell::new(pr.title),
Cell::new(pr.number.to_string()),
]
}));
table.to_string()

View File

@ -42,6 +42,7 @@ impl ReviewBackend for DefaultReviewBackend {
}
fn present_prs(&self, table: String) -> eyre::Result<()> {
println!("{table}");
Ok(())
}
}