Initial commit

This commit is contained in:
2023-07-22 06:32:44 +00:00
commit 9bb2865a65
15 changed files with 964 additions and 0 deletions

29
cmd/root.go Normal file
View File

@@ -0,0 +1,29 @@
package cmd
import (
"github.com/spf13/cobra"
"go.uber.org/zap"
)
var rootCmd = &cobra.Command{
Use: "hook",
}
func Execute() {
if Version == "dev" {
logger, err := zap.NewDevelopment()
if err != nil {
panic(err)
}
zap.ReplaceGlobals(logger)
} else {
logger, err := zap.NewProduction()
if err != nil {
panic(err)
}
zap.ReplaceGlobals(logger)
}
if err := rootCmd.Execute(); err != nil {
zap.L().Fatal("failed to execute root command", zap.Error(err))
}
}