Skip to content

Commit

Permalink
fix: issue a more friendly error message when user loads tempus pre-N…
Browse files Browse the repository at this point in the history
…eovim `0.10.0` (#1035)
  • Loading branch information
vhyrro committed Sep 9, 2023
1 parent c2a2937 commit 333a1fd
Showing 1 changed file with 3 additions and 12 deletions.
15 changes: 3 additions & 12 deletions lua/neorg/modules/core/tempus/module.lua
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,12 @@ and `to_lua_date(date) -> osdate`.
--]]
local neorg = require("neorg.core")
local lib, log, modules, utils = neorg.lib, neorg.log, neorg.modules, neorg.utils
local lib, modules, utils = neorg.lib, neorg.modules, neorg.utils
local module = modules.create("core.tempus")
assert(vim.re ~= nil, "Neovim 0.10.0+ is required to run the `core.tempus` module! ")
-- NOTE: Maybe encapsulate whole date parser in a single PEG grammar?
local _, time_regex = pcall(vim.re.compile, [[{%d%d?} ":" {%d%d} ("." {%d%d?})?]])

Expand Down Expand Up @@ -213,17 +215,6 @@ local timezone_list = {
"YEKT",
}

module.setup = function()
if not utils.is_minimum_version(0, 10, 0) then
log.error("`core.tempus` requires at least Neovim version 0.10.0 to run!")
return {
success = false,
}
end

return {}
end

---@alias Date {weekday: {name: string, number: number}?, day: number?, month: {name: string, number: number}?, year: number?, timezone: string?, time: {hour: number, minute: number, second: number?}?}

module.public = {
Expand Down

0 comments on commit 333a1fd

Please sign in to comment.