main.go 910 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. package main
  2. import (
  3. "fmt"
  4. "os"
  5. "xgAutoTest/internal/auto"
  6. "xgAutoTest/internal/config"
  7. "xgAutoTest/internal/dbBase"
  8. "xgAutoTest/internal/global"
  9. "xgAutoTest/internal/utils"
  10. )
  11. func main() {
  12. if len(os.Args) < 2 {
  13. fmt.Println("请输入配置文件路径")
  14. return
  15. }
  16. path := os.Args[1]
  17. if path == "version" {
  18. fmt.Println("当前版本:demo")
  19. return
  20. }
  21. fmt.Println("配置文件路径:", path)
  22. checkAll()
  23. global.Init()
  24. config := config.ConfigInfo{}
  25. config.GetConfigInfo(path)
  26. //dbBase.InitDb("10.28.20.101", "5190", "TESTDB", "SYSDBA", "SYSDBA")
  27. fmt.Println(config.DbInfo)
  28. dbBase.InitDb(config.DbInfo.Ip, config.DbInfo.Prot, config.DbInfo.Database, config.DbInfo.User, config.DbInfo.PassWord)
  29. auto.AutoRun(config)
  30. db := dbBase.GetDb()
  31. defer db.Close()
  32. }
  33. func checkAll() {
  34. //检查文件夹
  35. ret := utils.CheckFolder("./file")
  36. if !ret {
  37. utils.CreateFolder("./file")
  38. }
  39. }