From 4acd5cbce9945ef044dc997cb82cfad8273a0dbc Mon Sep 17 00:00:00 2001 From: Teddy Wing Date: Sat, 25 Jul 2020 18:38:10 +0200 Subject: Add git-sugapply bin An executable to apply a suggested change to the appropriate file in the repo. Add a new `SuggestionUrl` type that allows us to extract the necessary data to fetch a suggestion comment from the GitHub API using a GitHub pull request comment URL. --- src/lib.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src/lib.rs') diff --git a/src/lib.rs b/src/lib.rs index 3b94993..2febe7d 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,6 +1,11 @@ #![warn(rust_2018_idioms)] +mod url; + +pub use crate::url::SuggestionUrl; + + use std::fs; use std::fs::{File, OpenOptions}; use std::io::{BufRead, BufReader, Write}; @@ -109,7 +114,7 @@ impl Suggestion { s.replace("```", "") } - fn apply(&self) -> Result<(), Error> { + pub fn apply(&self) -> Result<(), Error> { let repo = Repository::open(".").unwrap(); let repo_root = repo.workdir().unwrap(); -- cgit v1.2.3