MCPcopy
hub / github.com/1Password/for-open-source / main

Function main

script/main.go:26–78  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

24}
25
26func main() {
27 if len(os.Args) < 2 {
28 printUsageAndExit()
29 }
30
31 command := os.Args[1]
32
33 if len(os.Args) == 4 && os.Args[2] == "--test" {
34 setTestApplication(os.Args[3])
35 } else if len(os.Args) != 2 {
36 printUsageAndExit()
37 }
38
39 sentryDsn, err := getEnv("SENTRY_DSN")
40 if err != nil && !isTesting() {
41 log.Fatal(err)
42 }
43
44 err = sentry.Init(sentry.ClientOptions{
45 Dsn: sentryDsn,
46 })
47 if err != nil {
48 log.Fatalf("Sentry initialization failed: %v\n", err)
49 }
50
51 defer sentry.Flush(2 * time.Second)
52
53 github := GitHub{}
54 application := Application{}
55
56 switch command {
57 case "review":
58 reviewer := Reviewer{
59 gitHub: &github,
60 application: &application,
61 }
62 reviewer.Review()
63 case "approve":
64 approver := Approver{
65 gitHub: &github,
66 application: &application,
67 }
68 approver.Approve()
69 case "aggregate":
70 aggregator := Aggregator{
71 gitHub: &github,
72 }
73 aggregator.Aggregate()
74 default:
75 fmt.Printf("Invalid command: %s\n", command)
76 printUsageAndExit()
77 }
78}

Callers

nothing calls this directly

Calls 8

ReviewMethod · 0.95
ApproveMethod · 0.95
AggregateMethod · 0.95
printUsageAndExitFunction · 0.85
setTestApplicationFunction · 0.85
getEnvFunction · 0.85
isTestingFunction · 0.85
InitMethod · 0.80

Tested by

no test coverage detected