From f999a62da2e78f9210fe4403b76e91957b8cf646 Mon Sep 17 00:00:00 2001 From: Alexis Sellier Date: Thu, 6 Apr 2023 14:37:13 +0200 Subject: [PATCH] cli: Show patch status in color in `patch show` --- radicle-cli/src/commands/patch/show.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/radicle-cli/src/commands/patch/show.rs b/radicle-cli/src/commands/patch/show.rs index d19f24b9..824b231f 100644 --- a/radicle-cli/src/commands/patch/show.rs +++ b/radicle-cli/src/commands/patch/show.rs @@ -45,6 +45,7 @@ pub fn run( let Some(patch) = patches.get(patch_id)? else { anyhow::bail!("Patch `{patch_id}` not found"); }; + let state = patch.state(); let mut attrs = Table::<2, Paint>::new(TableOptions { spacing: 2, @@ -64,7 +65,12 @@ pub fn run( ]); attrs.push([ term::format::tertiary("Status".to_owned()), - term::format::default(patch.state().to_string()), + match state { + patch::State::Open => term::format::positive(state.to_string()), + patch::State::Draft => term::format::dim(state.to_string()), + patch::State::Archived => term::format::yellow(state.to_string()), + patch::State::Merged => term::format::primary(state.to_string()), + }, ]); let description = patch.description().trim();