MCPcopy Index your code
hub / github.com/nikivdev/go / main

Function main

cli/github/main.go:21–52  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

19)
20
21func main() {
22 // Handle default case: if first arg looks like a PR ref, run diff
23 if len(os.Args) > 1 && looksLikePRRef(os.Args[1]) {
24 if err := runDiffDirect(os.Args[1], os.Args[2:]); err != nil {
25 fmt.Fprintln(os.Stderr, err)
26 os.Exit(1)
27 }
28 return
29 }
30
31 app := snap.New(commandName, "GitHub CLI for PR operations").
32 Version(version)
33
34 app.Command("diff", "Get full diff of a GitHub PR").
35 Action(runDiff)
36
37 app.Command("version", "Show version").
38 Action(func(ctx *snap.Context) error {
39 fmt.Fprintln(ctx.Stdout(), version)
40 return nil
41 })
42
43 app.Command("deploy", "Build and install ghx to ~/bin").
44 Action(runDeploy)
45
46 if len(os.Args) == 1 {
47 showHelpDirect()
48 return
49 }
50
51 app.RunAndExit()
52}
53
54func showHelpDirect() {
55 fmt.Printf("%s - GitHub CLI for PR operations\n\n", commandName)

Callers

nothing calls this directly

Calls 3

looksLikePRRefFunction · 0.85
runDiffDirectFunction · 0.85
showHelpDirectFunction · 0.85

Tested by

no test coverage detected