Project Amber CLI client
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

main.go 748B

123456789101112131415161718192021222324252627282930313233
  1. package main
  2. import (
  3. "os"
  4. "git.tdem.in/tdemin/amber_cli/cmd"
  5. "git.tdem.in/tdemin/amber_cli/conf"
  6. "git.tdem.in/tdemin/amber_cli/db"
  7. "git.tdem.in/tdemin/amber_cli/log"
  8. "git.tdem.in/tdemin/amber_cli/merge"
  9. _ "github.com/mattn/go-sqlite3"
  10. )
  11. func main() {
  12. conf.Config = conf.ReadConfig(conf.GetConfigPath())
  13. appPath := conf.DetermineAppPath()
  14. appDirExists, aderr := os.Stat(appPath)
  15. if aderr != nil || appDirExists == nil {
  16. log.Info(appPath + " does not exist, creating it.")
  17. mkdirerr := os.Mkdir(appPath, 0777)
  18. if mkdirerr != nil {
  19. log.Die(mkdirerr)
  20. }
  21. }
  22. cmd.ParseEnv(conf.Config)
  23. db.Database = db.InitDatabase()
  24. if conf.Config.Token != "" {
  25. merge.ResyncWithRemote()
  26. }
  27. cmd.ParseArgs()
  28. db.CloseDatabase(db.Database)
  29. }