Init: bootstrap go module with basic framework
This commit is contained in:
27
cmd/root.go
Normal file
27
cmd/root.go
Normal file
@@ -0,0 +1,27 @@
|
||||
package cmd
|
||||
|
||||
import (
|
||||
"strings"
|
||||
|
||||
"gitea.konchin.com/service/amane-tanikaze-dcbot/amane/cmd/migrates"
|
||||
"github.com/spf13/cobra"
|
||||
"github.com/spf13/viper"
|
||||
)
|
||||
|
||||
var RootCmd = &cobra.Command{
|
||||
Use: "amane",
|
||||
Short: "Amane Tanikaze Discord Bot",
|
||||
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(dcbotCmd)
|
||||
RootCmd.AddCommand(backendCmd)
|
||||
RootCmd.AddCommand(migrates.RootCmd)
|
||||
}
|
||||
Reference in New Issue
Block a user