示例#1
0
文件: main.go 项目: 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)
}
示例#2
0
文件: scope.go 项目: 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)
}
示例#3
0
文件: main.go 项目: pocke/to-gist
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
}