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)
| 89 | // environment variables, and returns a ready-to-use context, client, and |
| 90 | // enterprise slug. |
| 91 | func 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 | |
| 104 | func runCreate(args []string) { |
| 105 | fs, enterprise := newFlagSet("create") |
no test coverage detected
searching dependent graphs…