Example #1
0
File: main.go Project: pocke/gha
func main() {
	key, err := gha.CLI("test-key", &gha.Request{
		Note: "test app for gha",
	})
	if err != nil {
		panic(err)
	}
	fmt.Println(key)
}
Example #2
0
File: scope.go Project: pocke/gha
func main() {
	r := &gha.Request{
		Note:   "foo",
		Scopes: []string{"gist"},
	}

	key, err := gha.CLI("gha-test-scope", "gha-test-scope-key", r)
	if err != nil {
		panic(err)
	}
	fmt.Println(key)
}
Example #3
0
func getToken() (gha.RoundTripper, error) {
	keyFile, err := homedir.Expand("~/.config/to-gist.githubkey")
	if err != nil {
		return "", err
	}
	token, err := gha.CLI(keyFile, &gha.Request{
		Note:   "to-gist",
		Scopes: []string{"gist"},
	})
	if err != nil {
		return "", err
	}
	return gha.RoundTripper(token), nil
}