cobra setup

This commit is contained in:
t-dedah
2022-06-10 23:14:02 +05:30
parent e8ea897520
commit 45f4742cec
3 changed files with 57 additions and 21 deletions

27
main.go
View File

@@ -1,26 +1,11 @@
/*
Copyright © 2022 NAME HERE <EMAIL ADDRESS>
*/
package main
import (
"fmt"
"github.com/cli/go-gh"
)
import "github.com/t-dedah/gh-actions-cache/cmd"
func main() {
fmt.Println("hi world, this is the gh-actions-cache extension!")
client, err := gh.RESTClient(nil)
if err != nil {
fmt.Println(err)
return
}
response := struct {Login string}{}
err = client.Get("user", &response)
if err != nil {
fmt.Println(err)
return
}
fmt.Printf("running as %s\n", response.Login)
cmd.Execute()
}
// For more examples of using go-gh, see:
// https://github.com/cli/go-gh/blob/trunk/example_gh_test.go