Files
vern-nvim/lua/vern/templates/init.lua
T
2026-10-22 00:19:19 -04:00

20 lines
555 B
Lua

local M = {}
---@param path string Filetype of template
---@param kind string Template in language table
---@param name string A string to replace temp values in template
---@return string
function M.fetch(kind_path, kind, name)
kind_path, kind, name = kind_path or "", kind or "", name or ""
if kind_path == "" or kind == "" or name == "" then
return ""
end
local ok, mod = pcall(require, kind_path)
if ok and type(mod) == "table" then
return (string.gsub(mod[kind], "%%s", name))
end
return ""
end
return M