-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.go
40 lines (31 loc) · 844 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
package main
import (
"os"
cmd2 "github.com/omegion/cobra-commander"
"github.com/OpsVerseIO/argocd-actions/cmd"
)
const (
// Config file name where a config file will be created.
// For example, $HOME/.argocdActions/config.yaml.
configFileName = "argocdActions"
// The environment variable prefix of all environment variables bound to our command line flags.
// For example, --token is bound to ACDA_TOKEN.
configEnvPrefix = "ARGOCD"
)
func main() {
commander := cmd2.NewCommander(cmd.Root()).
SetCommand(
cmd.Version(),
cmd.Sync(),
).
SetConfig(getConfig()).
Init()
if err := commander.Execute(); err != nil {
os.Exit(1)
}
}
func getConfig() *cmd2.Config {
configName := configFileName
environmentPrefix := configEnvPrefix
return &cmd2.Config{Name: &configName, EnvironmentPrefix: &environmentPrefix}
}