MCPcopy
hub / github.com/cli/cli / main

Function main

script/build.go:76–113  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

74var self string
75
76func main() {
77 args := os.Args[:1]
78 for _, arg := range os.Args[1:] {
79 if idx := strings.IndexRune(arg, '='); idx >= 0 {
80 os.Setenv(arg[:idx], arg[idx+1:])
81 } else {
82 args = append(args, arg)
83 }
84 }
85
86 if len(args) < 2 {
87 if isWindowsTarget() {
88 args = append(args, filepath.Join("bin", "gh.exe"))
89 } else {
90 args = append(args, "bin/gh")
91 }
92 }
93
94 self = filepath.Base(args[0])
95 if self == "build" {
96 self = "build.go"
97 }
98
99 for _, task := range args[1:] {
100 t := tasks[normalizeTask(task)]
101 if t == nil {
102 fmt.Fprintf(os.Stderr, "Don't know how to build task `%s`.\n", task)
103 os.Exit(1)
104 }
105
106 err := t(task)
107 if err != nil {
108 fmt.Fprintln(os.Stderr, err)
109 fmt.Fprintf(os.Stderr, "%s: building task `%s` failed.\n", self, task)
110 os.Exit(1)
111 }
112 }
113}
114
115func isWindowsTarget() bool {
116 if os.Getenv("GOOS") == "windows" {

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