Exemple #1
0
func main() {
	key, err := gha.CLI("test-key", &gha.Request{
		Note: "test app for gha",
	})
	if err != nil {
		panic(err)
	}
	fmt.Println(key)
}
Exemple #2
0
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)
}
Exemple #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
}