2018-01-26 18:40:01 +08:00
|
|
|
package main
|
|
|
|
|
2019-05-21 11:31:40 +08:00
|
|
|
import (
|
2019-05-22 00:24:11 +08:00
|
|
|
"os"
|
|
|
|
fp "path/filepath"
|
|
|
|
|
2019-05-21 11:31:40 +08:00
|
|
|
"github.com/go-shiori/shiori/internal/cmd"
|
2019-05-22 00:24:11 +08:00
|
|
|
"github.com/go-shiori/shiori/internal/database"
|
|
|
|
_ "github.com/mattn/go-sqlite3"
|
2019-05-21 11:31:40 +08:00
|
|
|
"github.com/sirupsen/logrus"
|
|
|
|
)
|
|
|
|
|
2019-05-22 00:24:11 +08:00
|
|
|
var dataDir = "dev-data"
|
|
|
|
|
2018-05-01 11:23:38 +08:00
|
|
|
func main() {
|
2019-05-22 00:24:11 +08:00
|
|
|
// Make sure data dir exists
|
|
|
|
os.MkdirAll(dataDir, os.ModePerm)
|
|
|
|
|
|
|
|
// Open database
|
|
|
|
dbPath := fp.Join(dataDir, "shiori.db")
|
|
|
|
sqliteDB, err := database.OpenSQLiteDatabase(dbPath)
|
|
|
|
if err != nil {
|
|
|
|
logrus.Fatalln(err)
|
|
|
|
}
|
|
|
|
|
|
|
|
// Execute cmd
|
|
|
|
cmd.DB = sqliteDB
|
|
|
|
cmd.DataDir = dataDir
|
|
|
|
if err := cmd.ShioriCmd().Execute(); err != nil {
|
2019-05-21 11:31:40 +08:00
|
|
|
logrus.Fatalln(err)
|
|
|
|
}
|
2018-03-05 08:14:58 +08:00
|
|
|
}
|