nf/nft/nfctl/cmd/cmd.go
2024-07-14 17:26:48 +08:00

31 lines
524 B
Go

package cmd
import (
"github.com/loveuer/nf/nft/log"
"github.com/loveuer/nf/nft/nfctl/opt"
"github.com/spf13/cobra"
)
var (
Root = &cobra.Command{
Use: "nfctl",
Short: "nfctl: easy start your nf backend work",
PersistentPreRun: func(cmd *cobra.Command, args []string) {
if opt.Debug == true {
log.SetLogLevel(log.LogLevelDebug)
}
},
}
)
func init() {
initNew()
Root.PersistentFlags().BoolVar(&opt.Debug, "debug", false, "debug mode")
Root.AddCommand(
versionCmd,
checkCmd,
cmdNew,
)
}