Radish alpha
h
Radicle Heartwood Protocol & Stack
Radicle
Git (anonymous pull)
Log in to clone via SSH
cli: Show patch status in color in `patch show`
Alexis Sellier committed 3 years ago
commit f999a62da2e78f9210fe4403b76e91957b8cf646
parent 7d1e3d489bfaa47874b79907250188cb54cf8a7c
1 file changed +7 -1
modified 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<String>>::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();