The idea behind this is that a developer can opt to configure another library (e.g go-github) with a http client instance that has been configured to use gh-cli auth.
For example:
func NewClient() (Client, error) {
restClient, err := gh.RESTClient(nil)
if err != nil {
return nil, err
}
// This is https://github.com/google/go-github
g := github.NewClient(restClient.GetHttpClient())
currentRepository, err := gh.CurrentRepository()
if err != nil {
return nil, err
}
client := client{GitHub: g, owner: currentRepository.Owner(), repo: currentRepository.Name()}
return client, nil
}
Not sure if this implementation is of any use to you but thought i'd PR it as i've added it to my fork.
Closes #13.
The idea behind this is that a developer can opt to configure another library (e.g go-github) with a http client instance that has been configured to use gh-cli auth.
For example:
Not sure if this implementation is of any use to you but thought i'd PR it as i've added it to my fork.
Thanks!