cli/main.go
Corey Johnson 7a17f9506a Remove bang
Co-Authored-By: Josh Abernathy <joshaber@gmail.com>
2019-11-20 15:59:45 -08:00

25 lines
490 B
Go

package main
import (
"fmt"
"os"
"strings"
"github.com/github/gh-cli/command"
)
func main() {
printUpdateMessage := make(chan func())
go command.CheckForUpdate(printUpdateMessage)
if cmd, err := command.RootCmd.ExecuteC(); err != nil {
fmt.Fprintln(os.Stderr, err)
_, isFlagError := err.(command.FlagError)
if isFlagError || strings.HasPrefix(err.Error(), "unknown command ") {
fmt.Fprintln(os.Stderr, cmd.UsageString())
}
os.Exit(1)
}
(<-printUpdateMessage)()
}