shiori/main.go

34 lines
599 B
Go
Raw Normal View History

2018-04-28 22:02:36 +08:00
//go:generate go run assets-generator.go
2018-01-26 18:40:01 +08:00
package main
import (
2018-05-18 17:18:38 +08:00
fp "path/filepath"
"github.com/RadhiFadlillah/shiori/cmd"
2018-04-28 22:02:36 +08:00
dt "github.com/RadhiFadlillah/shiori/database"
2018-03-05 08:14:58 +08:00
_ "github.com/mattn/go-sqlite3"
2018-05-01 11:12:55 +08:00
"github.com/sirupsen/logrus"
)
2018-01-26 18:40:01 +08:00
2018-05-18 17:18:38 +08:00
var dataDir = "."
2018-03-05 08:14:58 +08:00
func main() {
2018-05-01 11:12:55 +08:00
// Open database
2018-06-08 17:25:17 +08:00
dbPath := fp.Join(dataDir, "shiori.db")
2018-05-01 11:12:55 +08:00
sqliteDB, err := dt.OpenSQLiteDatabase(dbPath)
2018-03-05 08:14:58 +08:00
checkError(err)
2018-05-01 11:12:55 +08:00
// Start cmd
2018-05-18 17:18:38 +08:00
shioriCmd := cmd.NewShioriCmd(sqliteDB, dataDir)
2018-04-28 22:02:36 +08:00
if err := shioriCmd.Execute(); err != nil {
logrus.Fatalln(err)
}
2018-03-05 08:14:58 +08:00
}
func checkError(err error) {
if err != nil {
panic(err)
}
}