-
Notifications
You must be signed in to change notification settings - Fork 3
/
main.go
51 lines (44 loc) · 1015 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
43
44
45
46
47
48
49
50
51
package main
import (
"fmt"
"os"
"sync/atomic"
"time"
"github.com/go-logr/logr"
"github.com/urfave/cli/v2"
)
var (
// these variables are populated by Goreleaser when releasing
version = "unknown"
commit = "-dirty-"
date = time.Now().Format("2006-01-02")
appName = "provider-exoscale"
appLongName = "Crossplane provider that deploys resources on exoscale.com"
)
func main() {
app := newApp()
err := app.Run(os.Args)
// If required flags aren't set, it will return with error before we could set up logging
if err != nil {
_, _ = fmt.Fprintf(os.Stderr, "%v\n", err)
os.Exit(1)
}
}
func newApp() *cli.App {
logInstance := &atomic.Value{}
logInstance.Store(logr.Discard())
app := &cli.App{
Name: appName,
Usage: appLongName,
Version: fmt.Sprintf("%s, revision=%s, date=%s", version, commit, date),
Before: setupLogging,
Flags: []cli.Flag{
newLogLevelFlag(),
newLogFormatFlag(),
},
Commands: []*cli.Command{
newOperatorCommand(),
},
}
return app
}