aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTeddy Wing2020-08-05 01:41:28 +0200
committerTeddy Wing2020-08-05 01:41:28 +0200
commitfd63548311453520eef6d20908ff6fc8454d11df (patch)
treef6d6ba70e271f118db4d3d764d546cd13ed7fcb7
parenta3dcf7fa8c14b809174edd725ef5d46557803521 (diff)
downloadgit-suggestion-fd63548311453520eef6d20908ff6fc8454d11df.tar.bz2
Add README
Found a suggestion on the `gh` GitHub CLI project page from 'mislav' (https://github.com/mislav) and 'probablycorey' (https://github.com/probablycorey) to use as an example. Haven't tested the install/uninstall instructions yet (copied these from another one of my projects).
-rw-r--r--README.md80
1 files changed, 80 insertions, 0 deletions
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..4d90d54
--- /dev/null
+++ b/README.md
@@ -0,0 +1,80 @@
+github-suggestion
+=================
+
+Diffs and patches for GitHub pull request suggestions. Given a suggestion ID,
+get a unified diff of the suggested change, or apply it directly to the working
+copy in a Git repository.
+
+
+## Examples
+
+ $ git clone https://github.com/cli/cli.git
+ Cloning into 'cli'...
+ …
+ $ cd cli/
+ $ git checkout 74a39f3
+ Note: checking out '74a39f3'.
+ …
+ $ git sugpatch https://github.com/cli/cli/pull/1150#discussion_r438352211
+ diff --git a/pkg/cmd/api/api.go b/pkg/cmd/api/api.go
+ index b4a8dbd..c081b50 100644
+ --- a/pkg/cmd/api/api.go
+ +++ b/pkg/cmd/api/api.go
+ @@ -247,8 +247,7 @@ func readUserFile(fn string, stdin io.ReadCloser) ([]byte, error) {
+ if fn == "-" {
+ r = stdin
+ } else {
+ - var err error
+ - r, err = os.Open(fn)
+ + r, err := os.Open(fn)
+ if err != nil {
+ return nil, err
+ }
+ $ git status
+ HEAD detached at 74a39f3
+ nothing to commit, working tree clean
+ $ git sugapply 438352211
+ $ git status
+ HEAD detached at 74a39f3
+ Changes not staged for commit:
+ (use "git add <file>..." to update what will be committed)
+ (use "git checkout -- <file>..." to discard changes in working directory)
+
+ modified: pkg/cmd/api/api.go
+
+ no changes added to commit (use "git add" and/or "git commit -a")
+ $ git diff
+ diff --git a/pkg/cmd/api/api.go b/pkg/cmd/api/api.go
+ index b4a8dbd..c081b50 100644
+ --- a/pkg/cmd/api/api.go
+ +++ b/pkg/cmd/api/api.go
+ @@ -247,8 +247,7 @@ func readUserFile(fn string, stdin io.ReadCloser) ([]byte, error) {
+ if fn == "-" {
+ r = stdin
+ } else {
+ - var err error
+ - r, err = os.Open(fn)
+ + r, err := os.Open(fn)
+ if err != nil {
+ return nil, err
+ }
+
+
+## Install
+On Mac OS X, GitHub-Suggestion can be installed with Homebrew:
+
+ $ brew install teddywing/formulae/github-suggestion
+
+To compile from source or install on other platforms:
+
+ $ cargo install --git https://github.com/teddywing/github-suggestion.git --root /usr/local
+
+
+## Uninstall
+
+ $ cargo uninstall --root /usr/local github-suggestion
+
+
+## License
+Copyright © 2020 Teddy Wing. Licensed under the GNU GPLv3+ (see the included
+COPYING file).