@@ -66,6 +66,7 @@ local default_config = {
66
66
)
67
67
end ,
68
68
init_filetypes = { " markdown" , " norg" , " yaml" },
69
+ papis_conf_keys = { " info-name" , " notes-name" , " dir" , " opentool" },
69
70
[" formatter" ] = {
70
71
format_notes_fn = function (entry )
71
72
local title_format = {
@@ -145,13 +146,13 @@ local default_config = {
145
146
}
146
147
147
148
--- Queries Papis to get various options.
148
- --- @param testing_session boolean #If true, will use testing papis conf
149
+ --- @param papis_conf_keys table #A table with keys to query from Papis
150
+ --- @param is_testing_session boolean #If true, will use testing papis conf
149
151
--- @return table #A table { info_name = val, dir = val }
150
- local function get_papis_py_conf (testing_session )
151
- local papis_conf_keys = { " info-name" , " notes-name" , " dir" }
152
+ local function get_papis_py_conf (papis_conf_keys , is_testing_session )
152
153
local papis_py_conf_new = {}
153
154
local testing_conf_path = " "
154
- if testing_session then
155
+ if is_testing_session then
155
156
testing_conf_path = " -c ./tests/papis_config "
156
157
end
157
158
for _ , key in ipairs (papis_conf_keys ) do
@@ -182,7 +183,8 @@ function M:update_papis_py_conf()
182
183
end
183
184
184
185
local is_testing_session = self [" enable_modules" ][" testing" ]
185
- local papis_py_conf_new = get_papis_py_conf (is_testing_session )
186
+ local papis_conf_keys = self [" papis_conf_keys" ]
187
+ local papis_py_conf_new = get_papis_py_conf (papis_conf_keys , is_testing_session )
186
188
local papis_py_conf_old = db .config :get ()[1 ]
187
189
papis_py_conf_old [" id" ] = nil
188
190
@@ -207,8 +209,9 @@ function M:setup_papis_py_conf()
207
209
-- get config from Papis if not already in db
208
210
if not db .config :is_setup () then
209
211
log .info (" Papis.nvim configuration not setup, importing values from Papis now" )
210
- local testing_session = self [" enable_modules" ][" testing" ]
211
- local papis_py_conf_new = get_papis_py_conf (testing_session )
212
+ local is_testing_session = self [" enable_modules" ][" testing" ]
213
+ local papis_conf_keys = self [" papis_conf_keys" ]
214
+ local papis_py_conf_new = get_papis_py_conf (papis_conf_keys , is_testing_session )
212
215
db .config :drop ()
213
216
db .config :update ({ id = 1 }, papis_py_conf_new )
214
217
end
0 commit comments