forked from premkit/premkit
-
Notifications
You must be signed in to change notification settings - Fork 0
/
premkit.go
45 lines (36 loc) · 962 Bytes
/
premkit.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
package commands
import (
"os"
"github.com/spf13/cobra"
"github.com/spf13/viper"
)
// PremkitCmd is the main (root) command for the CLI.
var PremkitCmd = &cobra.Command{
Use: "premkit",
Short: "premkit enables installable software",
Long: "premkit is the reverse proxy, used to ship installable software",
RunE: func(cmd *cobra.Command, args []string) error {
if err := InitializeConfig(); err != nil {
return err
}
cmd.Usage()
os.Exit(-1)
return nil
},
}
// Execute adds all child commands to the room command PremkitCmd and sets flags
func Execute() {
AddCommands()
if _, err := PremkitCmd.ExecuteC(); err != nil {
os.Exit(-1)
}
}
// AddCommands will add all child commands to the PremkitCmd
func AddCommands() {
PremkitCmd.AddCommand(daemonCmd)
}
// InitializeConfig initializes the config environment with defaults.
func InitializeConfig(subCmdVs ...*cobra.Command) error {
viper.SetEnvPrefix("premkit")
return nil
}