30 lines
648 B
Go
30 lines
648 B
Go
package cmd
|
|
|
|
import (
|
|
"github.com/loveuer/nf/nft/log"
|
|
"github.com/spf13/cobra"
|
|
"ultone/internal/opt"
|
|
)
|
|
|
|
func initRoot() {
|
|
rootCommand.PersistentFlags().BoolVar(&opt.Debug, "debug", false, "debug mode")
|
|
rootCommand.PersistentFlags().StringVarP(&filename, "config", "c", "etc/config.json", "config json file path")
|
|
rootCommand.PersistentPreRun = func(cmd *cobra.Command, args []string) {
|
|
if opt.Debug {
|
|
log.SetLogLevel(log.LogLevelDebug)
|
|
}
|
|
|
|
}
|
|
|
|
rootCommand.AddCommand(cliCommand)
|
|
}
|
|
|
|
var (
|
|
rootCommand = &cobra.Command{
|
|
Use: "nf-app",
|
|
RunE: func(cmd *cobra.Command, args []string) error {
|
|
return execute(cmd.Context())
|
|
},
|
|
}
|
|
)
|