fix: improve install.sh and init.lua

This commit is contained in:
JuanZoran
2022-12-22 11:06:49 +08:00
parent 92a4b9de91
commit 7772ce55a3
4 changed files with 22 additions and 4 deletions

View File

@@ -1,5 +1,5 @@
local M = {}
local dict = require("Trans").dict
local dict = require("Trans").db:open(M.conf.db_path)
function M.query(arg)
-- TODO: return type: a result table:

View File

@@ -15,7 +15,16 @@ function M.setup(conf)
require("Trans.setup")
end
M.db = require("sqlite.db")
M.dict = M.db:open(M.conf.db_path)
local res = vim.fn.executable('sqlite3')
if res ~= 1 then
error('Please check out sqlite3')
end
local status, db = pcall(require, 'sqlite.db')
if not status then
error('Please check out sqlite.lua')
end
M.db = db
return M