voidrice/.local/share/nvim/mason/packages/lua-language-server/libexec/script/version.lua

31 lines
559 B
Lua
Raw Permalink Normal View History

2024-01-27 16:26:04 +00:00
local fsu = require 'fs-utility'
local function loadVersion()
local changelog = fsu.loadFile(ROOT / 'changelog.md')
if not changelog then
return
end
local version, pos = changelog:match '%#%# (%d+%.%d+%.%d+)()'
if not version then
return
end
if not changelog:find('^[\r\n]+`', pos) then
version = version .. '-dev'
end
return version
end
local m = {}
function m.getVersion()
if not m.version then
m.version = loadVersion() or '<Unknown>'
end
return m.version
end
return m