Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var RootCmd = &cobra.Command{ Use: "lora-mqtt", Short: "A brief description of your application", Long: `A longer description that spans multiple lines and likely contains examples and usage of using your application. For example: Cobra is a CLI library for Go that empowers applications. This application is a tool to generate the needed files to quickly create a Cobra application.`, PersistentPreRun: func(cmd *cobra.Command, args []string) { var logLevel = log.InfoLevel var logHandlers []log.Handler if verbose { logHandlers = append(logHandlers, cliHandler.Default) } if debug { logLevel = log.DebugLevel } absLogFileLocation, err := filepath.Abs("lora-mqtt.log") if err != nil { panic(err) } logFile, err = os.OpenFile(absLogFileLocation, os.O_WRONLY|os.O_APPEND|os.O_CREATE, 0644) if err != nil { panic(err) } if err == nil { logHandlers = append(logHandlers, textHandler.New(logFile)) } log.SetHandler(multiHandler.New(logHandlers...)) log.SetLevel(logLevel) }, Run: func(cmd *cobra.Command, args []string) { checkConfig() start() }, PersistentPostRun: func(cmd *cobra.Command, args []string) { if logFile != nil { logFile.Close() } }, }
RootCmd represents the base command when called without any subcommands
Functions ¶
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.