-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.go
41 lines (36 loc) · 862 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
package main
import (
"context"
"flag"
"github.com/chirino/uc/internal/cmd"
_ "github.com/chirino/uc/internal/cmd/catalog"
_ "github.com/chirino/uc/internal/cmd/kamel"
_ "github.com/chirino/uc/internal/cmd/kubectl"
"github.com/chirino/uc/internal/cmd/uc"
_ "github.com/chirino/uc/internal/cmd/version"
"github.com/chirino/uc/internal/pkg/utils"
"github.com/spf13/pflag"
_ "k8s.io/client-go/plugin/pkg/client/auth/gcp"
"math/rand"
"os"
"time"
)
func main() {
rand.Seed(time.Now().UTC().UnixNano())
ctx, cancel := context.WithCancel(context.Background())
defer cancel() // Cancel ctx as soon as main returns
cmd, err := uc.New(&cmd.Options{
Context: ctx,
})
utils.ExitOnError(err)
err = cmd.Execute()
switch err {
case flag.ErrHelp:
fallthrough
case pflag.ErrHelp:
cmd.Help()
os.Exit(0)
default:
utils.ExitOnError(err)
}
}