MCPcopy Index your code
hub / github.com/google/go-github / parseAndInit

Function parseAndInit

example/auditlogstream/main.go:91–102  ·  view source on GitHub ↗

parseAndInit parses the FlagSet, validates the enterprise flag, reads environment variables, and returns a ready-to-use context, client, and enterprise slug.

(fs *flag.FlagSet, enterprise *string, args []string)

Source from the content-addressed store, hash-verified

89// environment variables, and returns a ready-to-use context, client, and
90// enterprise slug.
91func parseAndInit(fs *flag.FlagSet, enterprise *string, args []string) (context.Context, *github.Client, string) {
92 if err := fs.Parse(args); err != nil {
93 log.Fatalf("Error parsing flags: %v", err)
94 }
95
96 requireFlag("enterprise", *enterprise)
97
98 token := requireEnv("GITHUB_AUTH_TOKEN")
99 apiURL := requireEnv("GITHUB_API_URL")
100
101 return context.Background(), newClient(token, apiURL), *enterprise
102}
103
104func runCreate(args []string) {
105 fs, enterprise := newFlagSet("create")

Callers 2

runCreateFunction · 0.85
runDeleteFunction · 0.85

Calls 3

requireFlagFunction · 0.85
requireEnvFunction · 0.85
newClientFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…