MCPcopy Create free account
hub / github.com/cli/cli / main

Function main

script/build.go:79–116  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

77var self string
78
79func main() {
80 args := os.Args[:1]
81 for _, arg := range os.Args[1:] {
82 if idx := strings.IndexRune(arg, '='); idx >= 0 {
83 os.Setenv(arg[:idx], arg[idx+1:])
84 } else {
85 args = append(args, arg)
86 }
87 }
88
89 if len(args) < 2 {
90 if isWindowsTarget() {
91 args = append(args, filepath.Join("bin", "gh.exe"))
92 } else {
93 args = append(args, "bin/gh")
94 }
95 }
96
97 self = filepath.Base(args[0])
98 if self == "build" {
99 self = "build.go"
100 }
101
102 for _, task := range args[1:] {
103 t := tasks[normalizeTask(task)]
104 if t == nil {
105 fmt.Fprintf(os.Stderr, "Don't know how to build task `%s`.\n", task)
106 os.Exit(1)
107 }
108
109 err := t(task)
110 if err != nil {
111 fmt.Fprintln(os.Stderr, err)
112 fmt.Fprintf(os.Stderr, "%s: building task `%s` failed.\n", self, task)
113 os.Exit(1)
114 }
115 }
116}
117
118// builtWithTags reports whether the binary at exe was built with the given build tags, so switching tags (for
119// example between `make debug` and `make`) forces a rebuild even when sources have not changed.

Callers

nothing calls this directly

Calls 4

isWindowsTargetFunction · 0.85
normalizeTaskFunction · 0.85
JoinMethod · 0.80
BaseMethod · 0.80

Tested by

no test coverage detected