aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib.rs
diff options
context:
space:
mode:
authorTeddy Wing2020-07-25 18:38:10 +0200
committerTeddy Wing2020-07-25 18:38:10 +0200
commit4acd5cbce9945ef044dc997cb82cfad8273a0dbc (patch)
tree909aaf4615d08f1cadb299d5876dfa11a16a0c0b /src/lib.rs
parenta22f7a574cbbad22ed637405bafee42593eab87b (diff)
downloadgit-suggestion-4acd5cbce9945ef044dc997cb82cfad8273a0dbc.tar.bz2
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.
Diffstat (limited to 'src/lib.rs')
-rw-r--r--src/lib.rs7
1 files changed, 6 insertions, 1 deletions
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();