Skip to content

Commit 5f59c9c

Browse files
mislavmntlty
andauthored
Overhaul README for stable release (#89)
Co-authored-by: Ariel Deitcher <[email protected]>
1 parent c1d8f50 commit 5f59c9c

File tree

1 file changed

+26
-30
lines changed

1 file changed

+26
-30
lines changed

README.md

Lines changed: 26 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,69 +1,65 @@
1-
# go-gh beta
1+
# Go library for the GitHub CLI
22

3-
**This project is in beta!** Feedback is welcome.
3+
`go-gh` is a collection of Go modules to make authoring [GitHub CLI extensions][extensions] easier.
44

5-
A Go module for CLI Go applications and [gh extensions][extensions] that want a convenient way to interact with [gh][], and the GitHub API using [gh][] environment configuration.
5+
Modules from this library will obey GitHub CLI conventions by default:
66

7-
`go-gh` supports multiple ways of getting access to `gh` functionality:
7+
- [`CurrentRepository()`](https://pkg.go.dev/github.com/cli/go-gh#CurrentRepository) respects the value of the `GH_REPO` environment variable and reads from git remote configuration as fallback.
88

9-
* Helpers that automatically read a `gh` config to authenticate themselves
10-
* `gh.Exec` shells out to a `gh` install on your machine
9+
- GitHub API requests will be authenticated using the same mechanism as `gh`, i.e. using the values of `GH_TOKEN` and `GH_HOST` environment variables and falling back to the user's stored OAuth token.
1110

12-
If you'd like to use `go-gh` on systems without `gh` installed and configured, you can provide custom authentication details to the `go-gh` API helpers.
11+
- [Terminal capabilities](https://pkg.go.dev/github.com/cli/go-gh/pkg/term) are determined by taking environment variables `GH_FORCE_TTY`, `NO_COLOR`, `CLICOLOR`, etc. into account.
1312

13+
- Generating [table](https://pkg.go.dev/github.com/cli/go-gh/pkg/tableprinter) or [Go template](https://pkg.go.dev/github.com/cli/go-gh/pkg/template) output uses the same engine as gh.
1414

15-
## Installation
16-
```bash
17-
go get github.com/cli/go-gh
18-
```
15+
- The [`browser`](https://pkg.go.dev/github.com/cli/go-gh/pkg/browser) module activates the user's preferred web browser.
1916

2017
## Usage
18+
19+
See the full `go-gh` [reference documentation](https://pkg.go.dev/github.com/cli/go-gh) for more information
20+
2121
```golang
2222
package main
23+
2324
import (
2425
"fmt"
26+
"log"
2527
"github.com/cli/go-gh"
2628
)
2729

2830
func main() {
2931
// These examples assume `gh` is installed and has been authenticated
3032

31-
// Execute `gh issue list -R cli/cli`, and print the output.
32-
args := []string{"issue", "list", "-R", "cli/cli"}
33-
stdOut, _, err := gh.Exec(args...)
33+
// Shell out to a gh command and read its output
34+
issueList, _, err := gh.Exec("issue", "list", "--repo", "cli/cli", "--limit", "5")
3435
if err != nil {
35-
fmt.Println(err)
36-
return
36+
log.Fatal(err)
3737
}
38-
fmt.Println(stdOut.String())
38+
fmt.Println(issueList.String())
3939

4040
// Use an API helper to grab repository tags
4141
client, err := gh.RESTClient(nil)
4242
if err != nil {
43-
fmt.Println(err)
44-
return
43+
log.Fatal(err)
4544
}
46-
response := []struct{ Name string }{}
45+
response := []struct{
46+
Name string
47+
}{}
4748
err = client.Get("repos/cli/cli/tags", &response)
4849
if err != nil {
49-
fmt.Println(err)
50-
return
50+
log.Fatal(err)
5151
}
5252
fmt.Println(response)
5353
}
5454
```
5555

56-
See [examples][examples] for more use cases.
57-
58-
## Reference Documentation
59-
60-
Full reference docs can be found on [pkg.go.dev](https://pkg.go.dev/github.com/cli/go-gh).
56+
See [examples][] for more demonstrations of usage.
6157

6258
## Contributing
6359

64-
If anything feels off, or if you feel that some functionality is missing, please check out the [contributing page][contributing]. There you will find instructions for sharing your feedback, and submitting pull requests to the project.
60+
If anything feels off, or if you feel that some functionality is missing, please check out our [contributing docs][contributing]. There you will find instructions for sharing your feedback and for submitting pull requests to the project. Thank you!
61+
6562

66-
[extensions]: https://github.com/topics/gh-extension
67-
[gh]: https://github.com/cli/cli
63+
[extensions]: https://docs.github.com/en/github-cli/github-cli/creating-github-cli-extensions
6864
[examples]: ./example_gh_test.go
6965
[contributing]: ./.github/CONTRIBUTING.md

0 commit comments

Comments
 (0)