forked from cloudquery/cloudquery
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathroot.go
More file actions
38 lines (32 loc) · 675 Bytes
/
root.go
File metadata and controls
38 lines (32 loc) · 675 Bytes
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
package cmd
import (
"github.com/spf13/cobra"
"github.com/spf13/viper"
"log"
"os"
"strings"
"time"
)
// Injected with at build time with -ldflags "-X github.com/cloudquery/cloudquery/cmd.Variable=Value"
var Version = "development"
var Commit = "development"
var Date = time.Now().String()
var rootCmd = &cobra.Command{
Use: "cloudquery",
Short: "cloudquery CLI",
Version: Version,
}
func Execute() {
if err := rootCmd.Execute(); err != nil {
log.Println(err)
os.Exit(1)
}
}
func init() {
cobra.OnInitialize(initConfig)
}
func initConfig() {
viper.AutomaticEnv()
viper.SetEnvPrefix("CQ")
viper.SetEnvKeyReplacer(strings.NewReplacer("-", "_"))
}