Feat: done tcp
This commit is contained in:
34
cmds/root.go
Normal file
34
cmds/root.go
Normal file
@@ -0,0 +1,34 @@
|
||||
package cmds
|
||||
|
||||
import (
|
||||
"strings"
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
"github.com/spf13/viper"
|
||||
"go.uber.org/zap"
|
||||
)
|
||||
|
||||
var RootCmd = &cobra.Command{
|
||||
Use: "lab4",
|
||||
PersistentPreRun: func(cmd *cobra.Command, args []string) {
|
||||
viper.AutomaticEnv()
|
||||
viper.SetEnvKeyReplacer(strings.NewReplacer("-", "_"))
|
||||
viper.BindPFlags(cmd.PersistentFlags())
|
||||
viper.BindPFlags(cmd.Flags())
|
||||
|
||||
cfg := zap.NewProductionConfig()
|
||||
logger, err := cfg.Build()
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
zap.ReplaceGlobals(logger)
|
||||
},
|
||||
}
|
||||
|
||||
func init() {
|
||||
cobra.EnableTraverseRunHooks = true
|
||||
|
||||
RootCmd.AddCommand(serverCmd)
|
||||
RootCmd.AddCommand(clientCmd)
|
||||
}
|
||||
Reference in New Issue
Block a user