31 lines
535 B
Go
31 lines
535 B
Go
package main
|
|
|
|
import (
|
|
"strings"
|
|
|
|
"github.com/spf13/cobra"
|
|
"github.com/spf13/viper"
|
|
)
|
|
|
|
var RootCmd = &cobra.Command{
|
|
Use: "game",
|
|
PersistentPreRun: func(cmd *cobra.Command, args []string) {
|
|
viper.AutomaticEnv()
|
|
viper.SetEnvKeyReplacer(strings.NewReplacer("_", "-"))
|
|
viper.BindPFlags(cmd.PersistentFlags())
|
|
viper.BindPFlags(cmd.Flags())
|
|
},
|
|
}
|
|
|
|
func main() {
|
|
RootCmd.Execute()
|
|
}
|
|
|
|
func init() {
|
|
cobra.EnableTraverseRunHooks = true
|
|
|
|
RootCmd.AddCommand(authCmd)
|
|
RootCmd.AddCommand(playerCmd)
|
|
RootCmd.AddCommand(testCmd)
|
|
}
|