Skip to content

Commit 99aae36

Browse files
author
jghauser
committed
fix(config): use correct config file if testing is enabled
1 parent 9017f38 commit 99aae36

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

README.md

+6-1
Original file line numberDiff line numberDiff line change
@@ -261,9 +261,14 @@ yq_bin = "yq",
261261
-- Function to execute when adding a new note. `ref` is the citation key of the
262262
-- relevant entry and `notes_name` is defined in `papis_python` above.
263263
create_new_note_fn = function(papis_id, notes_name)
264+
local testing_session = require("papis.config")["enable_modules"]["testing"]
265+
local testing_conf_path = ""
266+
if testing_session then
267+
testing_conf_path = "-c ./tests/papis_config "
268+
end
264269
vim.fn.system(
265270
string.format(
266-
"papis update --set notes %s papis_id:%s",
271+
"papis " .. testing_conf_path .. "update --set notes %s papis_id:%s",
267272
vim.fn.shellescape(notes_name),
268273
vim.fn.shellescape(papis_id)
269274
)

lua/papis/config.lua

+6-1
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,14 @@ local default_config = {
5252
db_path = vim.fn.stdpath("data") .. "/papis_db/papis-nvim.sqlite3",
5353
yq_bin = "yq",
5454
create_new_note_fn = function(papis_id, notes_name)
55+
local testing_session = require("papis.config")["enable_modules"]["testing"]
56+
local testing_conf_path = ""
57+
if testing_session then
58+
testing_conf_path = "-c ./tests/papis_config "
59+
end
5560
vim.fn.system(
5661
string.format(
57-
"papis update --set notes %s papis_id:%s",
62+
"papis " .. testing_conf_path .. "update --set notes %s papis_id:%s",
5863
vim.fn.shellescape(notes_name),
5964
vim.fn.shellescape(papis_id)
6065
)

0 commit comments

Comments
 (0)