From b2ba972a1e1c08618c81648584a3cd62b50371d7 Mon Sep 17 00:00:00 2001 From: Patrick Date: Fri, 15 Nov 2024 13:23:33 +0100 Subject: [PATCH] fix: do not overwrite whole file --- src/main.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/main.rs b/src/main.rs index f1ef24e..fc31799 100644 --- a/src/main.rs +++ b/src/main.rs @@ -219,7 +219,11 @@ async fn main() -> Result<()> { get_diff(pr, &opts.path, &client).await?; let pr = get_pr(pr, &client).await?; let title = pr.title.replace("\n", "//"); - fs::write(&opts.pr_file, format!("{} # {}", pr.number, title))?; + let file = OpenOptions::new() + .write(true) + .append(true) + .open(&opts.pr_file)?; + writeln!(file, format!("{} # {}", pr.number, title))?; } }; Ok(())