mirror of
https://github.com/kristoferssolo/telescope-frecency.nvim.git
synced 2026-02-04 23:02:06 +00:00
feat: make database location configurable
This commit is contained in:
@@ -85,10 +85,11 @@ local function validate_db(safe_mode)
|
||||
end
|
||||
end
|
||||
|
||||
local function init(config_ignore_patterns, safe_mode, auto_validate)
|
||||
-- TODO: make init params a keyed table
|
||||
local function init(db_root, config_ignore_patterns, safe_mode, auto_validate)
|
||||
if sql_wrapper then return end
|
||||
sql_wrapper = sqlwrap:new()
|
||||
local first_run = sql_wrapper:bootstrap()
|
||||
local first_run = sql_wrapper:bootstrap(db_root)
|
||||
ignore_patterns = config_ignore_patterns or default_ignore_patterns
|
||||
|
||||
if auto_validate then
|
||||
|
||||
@@ -34,14 +34,14 @@ function M:new()
|
||||
return o
|
||||
end
|
||||
|
||||
function M:bootstrap(opts)
|
||||
function M:bootstrap(db_root)
|
||||
if self.db then return end
|
||||
|
||||
opts = opts or {}
|
||||
self.max_entries = opts.max_entries or 2000
|
||||
-- opts = opts or {}
|
||||
-- self.max_entries = opts.max_entries or 2000
|
||||
|
||||
-- create the db if it doesn't exist
|
||||
local db_root = opts.docs_root or vim.fn.stdpath('data')
|
||||
db_root = db_root or vim.fn.stdpath('data')
|
||||
local db_filename = db_root .. "/file_frecency.sqlite3"
|
||||
self.db = sql:open(db_filename)
|
||||
if not self.db then
|
||||
|
||||
Reference in New Issue
Block a user