chore: nfctl version, check cmd

This commit is contained in:
loveuer
2024-07-14 17:26:48 +08:00
parent cbb959a31e
commit 52ec9a0686
11 changed files with 156 additions and 80 deletions

View File

@ -1,19 +1,30 @@
package cmd
import "github.com/spf13/cobra"
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,
)
}