add test db
This commit is contained in:
@@ -29,6 +29,9 @@ var (
|
||||
baudrate int
|
||||
bytesize byte
|
||||
|
||||
dbFile string
|
||||
dbInit bool
|
||||
|
||||
// rootCmd represents the base command when called without any subcommands
|
||||
rootCmd = &cobra.Command{
|
||||
Use: "tele-recv",
|
||||
@@ -90,5 +93,7 @@ func initConfig() {
|
||||
device = viper.GetString("serial.device")
|
||||
baudrate = viper.GetInt("serial.baudrate")
|
||||
bytesize = byte(viper.GetInt("serial.bytesize"))
|
||||
dbFile = viper.GetString("sqlite.file")
|
||||
dbInit = viper.GetBool("sqlite.init")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,6 +20,7 @@ import (
|
||||
"github.com/spf13/cobra"
|
||||
"github.com/tarm/serial"
|
||||
"os"
|
||||
"it2000.com.cn/tele-recv/database"
|
||||
)
|
||||
|
||||
// testCmd represents the test command
|
||||
@@ -39,6 +40,8 @@ Test serial port`,
|
||||
}
|
||||
fmt.Println(c , "opened")
|
||||
_ = s.Close()
|
||||
|
||||
database.Init(dbFile, dbInit)
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user