Radish alpha
h
Radicle Heartwood Protocol & Stack
Radicle
Git (anonymous pull)
Log in to clone via SSH
cli: Vanity review.rs update
Slack Coder committed 2 years ago
commit 2a0643cf1caf336f37a2180d2f30b9e74efc835b
parent fe00ed7ca7baaa330c371b69566c1a22a4df4830
1 file changed +35 -36
modified radicle-cli/src/commands/review.rs
@@ -233,45 +233,44 @@ pub fn run(options: Options, ctx: impl term::Context) -> anyhow::Result<()> {
            by_hunk,
            unified,
            hunk,
-
        } => {
-
            if by_hunk {
-
                let mut opts = git::raw::DiffOptions::new();
-
                opts.patience(true)
-
                    .minimal(true)
-
                    .context_lines(unified as u32);
+
        } if by_hunk => {
+
            let mut opts = git::raw::DiffOptions::new();
+
            opts.patience(true)
+
                .minimal(true)
+
                .context_lines(unified as u32);

-
                builder::ReviewBuilder::new(patch_id, *profile.id(), &repository)
-
                    .hunk(hunk)
-
                    .verdict(verdict)
-
                    .run(revision, &mut opts)?;
+
            builder::ReviewBuilder::new(patch_id, *profile.id(), &repository)
+
                .hunk(hunk)
+
                .verdict(verdict)
+
                .run(revision, &mut opts)?;
+
        }
+
        Operation::Review { verdict, .. } => {
+
            let message = options.message.get(REVIEW_HELP_MSG)?;
+
            let message = message.replace(REVIEW_HELP_MSG.trim(), "");
+
            let message = if message.is_empty() {
+
                None
            } else {
-
                let message = options.message.get(REVIEW_HELP_MSG)?;
-
                let message = message.replace(REVIEW_HELP_MSG.trim(), "");
-
                let message = if message.is_empty() {
-
                    None
-
                } else {
-
                    Some(message)
-
                };
-
                patch.review(*revision_id, verdict, message, &signer)?;
+
                Some(message)
+
            };
+
            patch.review(*revision_id, verdict, message, &signer)?;

-
                match verdict {
-
                    Some(Verdict::Accept) => {
-
                        term::success!(
-
                            "Patch {} {}",
-
                            patch_id_pretty,
-
                            term::format::highlight("accepted")
-
                        );
-
                    }
-
                    Some(Verdict::Reject) => {
-
                        term::success!(
-
                            "Patch {} {}",
-
                            patch_id_pretty,
-
                            term::format::negative("rejected")
-
                        );
-
                    }
-
                    None => {
-
                        term::success!("Patch {} reviewed", patch_id_pretty);
-
                    }
+
            match verdict {
+
                Some(Verdict::Accept) => {
+
                    term::success!(
+
                        "Patch {} {}",
+
                        patch_id_pretty,
+
                        term::format::highlight("accepted")
+
                    );
+
                }
+
                Some(Verdict::Reject) => {
+
                    term::success!(
+
                        "Patch {} {}",
+
                        patch_id_pretty,
+
                        term::format::negative("rejected")
+
                    );
+
                }
+
                None => {
+
                    term::success!("Patch {} reviewed", patch_id_pretty);
                }
            }
        }