cli: Show patch status in color in `patch show`
This commit is contained in:
parent
7d1e3d489b
commit
f999a62da2
|
|
@ -45,6 +45,7 @@ pub fn run(
|
||||||
let Some(patch) = patches.get(patch_id)? else {
|
let Some(patch) = patches.get(patch_id)? else {
|
||||||
anyhow::bail!("Patch `{patch_id}` not found");
|
anyhow::bail!("Patch `{patch_id}` not found");
|
||||||
};
|
};
|
||||||
|
let state = patch.state();
|
||||||
|
|
||||||
let mut attrs = Table::<2, Paint<String>>::new(TableOptions {
|
let mut attrs = Table::<2, Paint<String>>::new(TableOptions {
|
||||||
spacing: 2,
|
spacing: 2,
|
||||||
|
|
@ -64,7 +65,12 @@ pub fn run(
|
||||||
]);
|
]);
|
||||||
attrs.push([
|
attrs.push([
|
||||||
term::format::tertiary("Status".to_owned()),
|
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();
|
let description = patch.description().trim();
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue