diff --git a/lua/org-roam.lua b/lua/org-roam.lua index e831ccd..b713aa4 100644 --- a/lua/org-roam.lua +++ b/lua/org-roam.lua @@ -14,7 +14,7 @@ end ---@field config org-roam.Config ---@field database org-roam.Database ---@field events org-roam.Events ----@field extensions org-roam.Extensions +---@field ext org-roam.Extensions ---@field setup org-roam.Setup ---@field ui org-roam.UserInterface ---@field utils org-roam.Utils @@ -73,7 +73,7 @@ function M:new(config) return require("org-roam.events")(instance) end - lazy.extensions = function() + lazy.ext = function() return require("org-roam.extensions")(instance) end diff --git a/lua/org-roam/setup/keybindings.lua b/lua/org-roam/setup/keybindings.lua index daa083c..a20cc03 100644 --- a/lua/org-roam/setup/keybindings.lua +++ b/lua/org-roam/setup/keybindings.lua @@ -248,7 +248,7 @@ local function assign_dailies_keybindings(roam) bindings.capture_date, "Capture a specific date's note", function() - roam.extensions.dailies.capture_date() + roam.ext.dailies.capture_date() end ) @@ -256,7 +256,7 @@ local function assign_dailies_keybindings(roam) bindings.capture_today, "Capture today's note", function() - roam.extensions.dailies.capture_today() + roam.ext.dailies.capture_today() end ) @@ -264,7 +264,7 @@ local function assign_dailies_keybindings(roam) bindings.capture_tomorrow, "Capture tomorrow's note", function() - roam.extensions.dailies.capture_tomorrow() + roam.ext.dailies.capture_tomorrow() end ) @@ -272,7 +272,7 @@ local function assign_dailies_keybindings(roam) bindings.capture_yesterday, "Capture yesterday's note", function() - roam.extensions.dailies.capture_yesterday() + roam.ext.dailies.capture_yesterday() end ) @@ -280,7 +280,7 @@ local function assign_dailies_keybindings(roam) bindings.find_directory, "Navigate to dailies note directory", function() - roam.extensions.dailies.find_directory() + roam.ext.dailies.find_directory() end ) @@ -288,7 +288,7 @@ local function assign_dailies_keybindings(roam) bindings.goto_date, "Navigate to a specific date's note", function() - roam.extensions.dailies.goto_date() + roam.ext.dailies.goto_date() end ) @@ -296,7 +296,7 @@ local function assign_dailies_keybindings(roam) bindings.goto_today, "Navigate to today's note", function() - roam.extensions.dailies.goto_today() + roam.ext.dailies.goto_today() end ) @@ -304,7 +304,7 @@ local function assign_dailies_keybindings(roam) bindings.goto_tomorrow, "Navigate to tomorrow's note", function() - roam.extensions.dailies.goto_tomorrow() + roam.ext.dailies.goto_tomorrow() end ) @@ -312,7 +312,7 @@ local function assign_dailies_keybindings(roam) bindings.goto_yesterday, "Navigate to yesterday's note", function() - roam.extensions.dailies.goto_yesterday() + roam.ext.dailies.goto_yesterday() end ) @@ -320,7 +320,7 @@ local function assign_dailies_keybindings(roam) bindings.goto_next_date, "Navigate to the next available note", function() - roam.extensions.dailies.goto_next_date() + roam.ext.dailies.goto_next_date() end ) @@ -328,7 +328,7 @@ local function assign_dailies_keybindings(roam) bindings.goto_prev_date, "Navigate to the previous available note", function() - roam.extensions.dailies.goto_prev_date() + roam.ext.dailies.goto_prev_date() end ) end diff --git a/spec/extensions_dailies_spec.lua b/spec/extensions_dailies_spec.lua index 9335ee7..ddb4bec 100644 --- a/spec/extensions_dailies_spec.lua +++ b/spec/extensions_dailies_spec.lua @@ -47,7 +47,7 @@ describe("org-roam.extensions.dailies", function() utils.mock_calendar("2024-04-27") -- Start the capture process - local id = roam.extensions.dailies.capture_date() + local id = roam.ext.dailies.capture_date() -- Wait a bit for the capture buffer to appear utils.wait() @@ -91,7 +91,7 @@ describe("org-roam.extensions.dailies", function() }) -- Start the capture process - local id = roam.extensions.dailies.capture_date({ + local id = roam.ext.dailies.capture_date({ date = utils.date_from_string("2024-04-27"), }) @@ -139,7 +139,7 @@ describe("org-roam.extensions.dailies", function() local date = os.date("%Y-%m-%d", Date.today().timestamp) -- Start the capture process - local id = roam.extensions.dailies.capture_today() + local id = roam.ext.dailies.capture_today() -- Wait a bit for the capture buffer to appear utils.wait() @@ -185,7 +185,7 @@ describe("org-roam.extensions.dailies", function() local date = os.date("%Y-%m-%d", Date.tomorrow().timestamp) -- Start the capture process - local id = roam.extensions.dailies.capture_tomorrow() + local id = roam.ext.dailies.capture_tomorrow() -- Wait a bit for the capture buffer to appear utils.wait() @@ -231,7 +231,7 @@ describe("org-roam.extensions.dailies", function() local date = os.date("%Y-%m-%d", Date.today():subtract({ day = 1 }).timestamp) -- Start the capture process - local id = roam.extensions.dailies.capture_yesterday() + local id = roam.ext.dailies.capture_yesterday() -- Wait a bit for the capture buffer to appear utils.wait() @@ -275,7 +275,7 @@ describe("org-roam.extensions.dailies", function() }) -- Do the navigation without opening the calendar - local date = roam.extensions.dailies.goto_date({ + local date = roam.ext.dailies.goto_date({ date = "2024-04-27", }):wait() @@ -292,7 +292,7 @@ describe("org-roam.extensions.dailies", function() roam.database:load():wait() -- Do the navigation without opening the calendar - local date = roam.extensions.dailies.goto_date({ + local date = roam.ext.dailies.goto_date({ date = "2024-04-27", }):wait() @@ -322,7 +322,7 @@ describe("org-roam.extensions.dailies", function() }) -- Do the navigation without opening the calendar - roam.extensions.dailies.goto_today():wait() + roam.ext.dailies.goto_today():wait() assert.are.same({ "some file", @@ -337,7 +337,7 @@ describe("org-roam.extensions.dailies", function() local date = os.date("%Y-%m-%d", Date.today().timestamp) --[[ @cast date string ]] -- Do the navigation without opening the calendar - roam.extensions.dailies.goto_today():wait() + roam.ext.dailies.goto_today():wait() local lines = utils.read_buffer() lines[2] = string.sub(lines[2], 1, 4) .. " " @@ -363,7 +363,7 @@ describe("org-roam.extensions.dailies", function() }) -- Do the navigation without opening the calendar - roam.extensions.dailies.goto_tomorrow():wait() + roam.ext.dailies.goto_tomorrow():wait() assert.are.same({ "some file", @@ -378,7 +378,7 @@ describe("org-roam.extensions.dailies", function() local date = os.date("%Y-%m-%d", Date.tomorrow().timestamp) --[[ @cast date string ]] -- Do the navigation without opening the calendar - roam.extensions.dailies.goto_tomorrow():wait() + roam.ext.dailies.goto_tomorrow():wait() local lines = utils.read_buffer() lines[2] = string.sub(lines[2], 1, 4) .. " " @@ -404,7 +404,7 @@ describe("org-roam.extensions.dailies", function() }) -- Do the navigation without opening the calendar - roam.extensions.dailies.goto_yesterday():wait() + roam.ext.dailies.goto_yesterday():wait() assert.are.same({ "some file", @@ -419,7 +419,7 @@ describe("org-roam.extensions.dailies", function() local date = os.date("%Y-%m-%d", Date.today():subtract({ day = 1 }).timestamp) --[[ @cast date string ]] -- Do the navigation without opening the calendar - roam.extensions.dailies.goto_yesterday():wait() + roam.ext.dailies.goto_yesterday():wait() local lines = utils.read_buffer() lines[2] = string.sub(lines[2], 1, 4) .. " " @@ -444,7 +444,7 @@ describe("org-roam.extensions.dailies", function() write_date_file("2024-04-29", "c") -- Do the navigation without opening the calendar - local date = roam.extensions.dailies.goto_next_date():wait() + local date = roam.ext.dailies.goto_next_date():wait() assert.is_nil(date) assert.are.same({ "test" }, utils.read_buffer()) @@ -461,7 +461,7 @@ describe("org-roam.extensions.dailies", function() vim.cmd.edit(path) -- Do the navigation without opening the calendar - local date = roam.extensions.dailies.goto_next_date():wait() + local date = roam.ext.dailies.goto_next_date():wait() assert.is_nil(date) assert.are.same({ "c" }, utils.read_buffer()) @@ -478,7 +478,7 @@ describe("org-roam.extensions.dailies", function() vim.cmd.edit(path) -- Do the navigation without opening the calendar - local date = roam.extensions.dailies.goto_next_date({ n = -1 }):wait() + local date = roam.ext.dailies.goto_next_date({ n = -1 }):wait() assert.is_nil(date) assert.are.same({ "a" }, utils.read_buffer()) @@ -495,7 +495,7 @@ describe("org-roam.extensions.dailies", function() vim.cmd.edit(path) -- Do the navigation without opening the calendar - local date = roam.extensions.dailies.goto_next_date():wait() + local date = roam.ext.dailies.goto_next_date():wait() assert.are.equal(utils.date_from_string("2024-04-05"), date) assert.are.same({ "c" }, utils.read_buffer()) @@ -512,7 +512,7 @@ describe("org-roam.extensions.dailies", function() vim.cmd.edit(path) -- Do the navigation without opening the calendar - local date = roam.extensions.dailies.goto_next_date({ n = -1 }):wait() + local date = roam.ext.dailies.goto_next_date({ n = -1 }):wait() assert.are.equal(utils.date_from_string("2024-04-01"), date) assert.are.same({ "a" }, utils.read_buffer()) @@ -528,10 +528,10 @@ describe("org-roam.extensions.dailies", function() vim.cmd.edit(path) - assert.is_nil(roam.extensions.dailies.goto_next_date({ n = 2 }):wait()) + assert.is_nil(roam.ext.dailies.goto_next_date({ n = 2 }):wait()) assert.are.same({ "b" }, utils.read_buffer()) - assert.is_nil(roam.extensions.dailies.goto_next_date({ n = -2 }):wait()) + assert.is_nil(roam.ext.dailies.goto_next_date({ n = -2 }):wait()) assert.are.same({ "b" }, utils.read_buffer()) end) @@ -547,7 +547,7 @@ describe("org-roam.extensions.dailies", function() vim.cmd.edit(path) - local date = roam.extensions.dailies.goto_next_date({ n = 2 }):wait() + local date = roam.ext.dailies.goto_next_date({ n = 2 }):wait() assert.are.equal(utils.date_from_string("2024-04-30"), date) assert.are.same({ "e" }, utils.read_buffer()) end) @@ -564,7 +564,7 @@ describe("org-roam.extensions.dailies", function() write_date_file("2024-04-29", "c") -- Do the navigation without opening the calendar - local date = roam.extensions.dailies.goto_prev_date():wait() + local date = roam.ext.dailies.goto_prev_date():wait() assert.is_nil(date) assert.are.same({ "test" }, utils.read_buffer()) @@ -581,7 +581,7 @@ describe("org-roam.extensions.dailies", function() vim.cmd.edit(path) -- Do the navigation without opening the calendar - local date = roam.extensions.dailies.goto_prev_date():wait() + local date = roam.ext.dailies.goto_prev_date():wait() assert.is_nil(date) assert.are.same({ "a" }, utils.read_buffer()) @@ -598,7 +598,7 @@ describe("org-roam.extensions.dailies", function() vim.cmd.edit(path) -- Do the navigation without opening the calendar - local date = roam.extensions.dailies.goto_prev_date({ n = -1 }):wait() + local date = roam.ext.dailies.goto_prev_date({ n = -1 }):wait() assert.is_nil(date) assert.are.same({ "c" }, utils.read_buffer()) @@ -615,7 +615,7 @@ describe("org-roam.extensions.dailies", function() vim.cmd.edit(path) -- Do the navigation without opening the calendar - local date = roam.extensions.dailies.goto_prev_date():wait() + local date = roam.ext.dailies.goto_prev_date():wait() assert.are.equal(utils.date_from_string("2024-04-01"), date) assert.are.same({ "a" }, utils.read_buffer()) @@ -632,7 +632,7 @@ describe("org-roam.extensions.dailies", function() vim.cmd.edit(path) -- Do the navigation without opening the calendar - local date = roam.extensions.dailies.goto_prev_date({ n = -1 }):wait() + local date = roam.ext.dailies.goto_prev_date({ n = -1 }):wait() assert.are.equal(utils.date_from_string("2024-04-05"), date) assert.are.same({ "c" }, utils.read_buffer()) @@ -648,10 +648,10 @@ describe("org-roam.extensions.dailies", function() vim.cmd.edit(path) - assert.is_nil(roam.extensions.dailies.goto_prev_date({ n = 2 }):wait()) + assert.is_nil(roam.ext.dailies.goto_prev_date({ n = 2 }):wait()) assert.are.same({ "b" }, utils.read_buffer()) - assert.is_nil(roam.extensions.dailies.goto_prev_date({ n = -2 }):wait()) + assert.is_nil(roam.ext.dailies.goto_prev_date({ n = -2 }):wait()) assert.are.same({ "b" }, utils.read_buffer()) end) @@ -667,7 +667,7 @@ describe("org-roam.extensions.dailies", function() vim.cmd.edit(path) - local date = roam.extensions.dailies.goto_prev_date({ n = 2 }):wait() + local date = roam.ext.dailies.goto_prev_date({ n = 2 }):wait() assert.are.equal(utils.date_from_string("2024-04-10"), date) assert.are.same({ "a" }, utils.read_buffer()) end)