Radish alpha
h
Radicle Heartwood Protocol & Stack
Radicle
Git (anonymous pull)
Log in to clone via SSH
patch-show: Show replies by default
Matthias Beyer committed 1 month ago
commit b6da3840180d087f40deb0ade93dfac05db78d51
parent 7bac17146c40b32b2ce0e27b96a555a44f3ef2ba
5 files changed +29 -4
modified crates/radicle-cli/src/commands/inbox.rs
@@ -432,7 +432,9 @@ fn show(
            let patches = term::cob::patches(profile, &repo)?;
            let patch = patches.get(&typed_id.id)?.unwrap();

-
            term::patch::show(&patch, &typed_id.id, false, &repo, None, profile)?;
+
            let verbose = false;
+
            let replies = true;
+
            term::patch::show(&patch, &typed_id.id, verbose, replies, &repo, None, profile)?;
        }
        NotificationKind::Cob { typed_id } if typed_id.is_identity() => {
            let identity = Identity::get(&typed_id.id, &repo)?;
modified crates/radicle-cli/src/commands/patch.rs
@@ -67,12 +67,24 @@ pub fn run(args: Args, ctx: impl term::Context) -> anyhow::Result<()> {
            list::run((&args.state).into(), authors, &repository, &profile)?;
        }

-
        Command::Show { id, patch, verbose } => {
+
        Command::Show {
+
            id,
+
            patch,
+
            verbose,
+
            replies,
+
            no_replies,
+
        } => {
            let patch_id = id.resolve(&repository.backend)?;
+

+
            // print replies by default or when --replies is passed.
+
            // Hide replies when --no-replies is passed
+
            let do_show_replies = !replies || no_replies;
+

            show::run(
                &patch_id,
                patch,
                verbose,
+
                do_show_replies,
                &profile,
                &repository,
                workdir.as_ref(),
modified crates/radicle-cli/src/commands/patch/args.rs
@@ -75,6 +75,15 @@ pub(super) enum Command {
        /// Verbose output
        #[arg(long, short)]
        verbose: bool,
+

+
        /// Show replies output
+
        #[clap(long, action = clap::ArgAction::SetTrue, overrides_with = "no_replies")]
+
        #[clap(default_value_t = true)]
+
        replies: bool,
+

+
        #[clap(long = "no-replies", action = clap::ArgAction::SetFalse, overrides_with = "replies")]
+
        #[clap(hide = true)]
+
        no_replies: bool,
    },

    /// Show the diff of a specific patch
modified crates/radicle-cli/src/commands/patch/show.rs
@@ -28,6 +28,7 @@ pub fn run(
    patch_id: &PatchId,
    diff: bool,
    verbose: bool,
+
    replies: bool,
    profile: &Profile,
    stored: &Repository,
    workdir: Option<&git::raw::Repository>,
@@ -40,7 +41,7 @@ pub fn run(
        anyhow::bail!("Patch `{patch_id}` not found");
    };

-
    term::patch::show(&patch, patch_id, verbose, stored, workdir, profile)?;
+
    term::patch::show(&patch, patch_id, verbose, replies, stored, workdir, profile)?;

    if diff {
        term::blank();
modified crates/radicle-cli/src/terminal/patch.rs
@@ -356,6 +356,7 @@ pub fn show(
    patch: &Patch,
    id: &PatchId,
    verbose: bool,
+
    replies: bool,
    stored: &Repository,
    workdir: Option<&git::raw::Repository>,
    profile: &Profile,
@@ -445,7 +446,7 @@ pub fn show(
        widget.push(line);
    }

-
    if verbose {
+
    if replies {
        for (id, comment) in revision.replies() {
            let hstack = term::comment::header(id, comment, profile);