www-jrtorres042-github-enterprise-org
/
git_microsoft-powershell_achived-credential_shield-tracker_covid-19_live_cam-hub_diff-1
Public template
forked from mislav/hub
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.go
42 lines (36 loc) · 680 Bytes
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
// +build go1.8
package main
import (
"os"
"os/exec"
"syscall"
"github.com/github/hub/v2/commands"
"github.com/github/hub/v2/github"
"github.com/github/hub/v2/ui"
)
func main() {
defer github.CaptureCrash()
err := commands.CmdRunner.Execute(os.Args)
exitCode := handleError(err)
os.Exit(exitCode)
}
func handleError(err error) int {
if err == nil {
return 0
}
switch e := err.(type) {
case *exec.ExitError:
if status, ok := e.Sys().(syscall.WaitStatus); ok {
return status.ExitStatus()
}
return 1
case *commands.ErrHelp:
ui.Println(err)
return 0
default:
if errString := err.Error(); errString != "" {
ui.Errorln(err)
}
return 1
}
}