26 lines
473 B
Go
26 lines
473 B
Go
package cmds
|
|
|
|
import (
|
|
"strings"
|
|
|
|
"github.com/spf13/cobra"
|
|
"github.com/spf13/viper"
|
|
)
|
|
|
|
var RootCmd = &cobra.Command{
|
|
Use: "root",
|
|
PersistentPreRun: func(cmd *cobra.Command, args []string) {
|
|
viper.AutomaticEnv()
|
|
viper.SetEnvKeyReplacer(strings.NewReplacer("-", "_"))
|
|
viper.BindPFlags(cmd.PersistentFlags())
|
|
viper.BindPFlags(cmd.Flags())
|
|
},
|
|
}
|
|
|
|
func init() {
|
|
cobra.EnableTraverseRunHooks = true
|
|
|
|
RootCmd.AddCommand(serveCmd)
|
|
RootCmd.AddCommand(genTokenCmd)
|
|
}
|