2021-09-04 13:14:01 +08:00
|
|
|
local theme = require "zenbones"
|
2021-09-04 15:42:35 +08:00
|
|
|
local terminal = require "zenbones.terminal"
|
2021-09-04 13:14:01 +08:00
|
|
|
|
2021-09-04 14:57:37 +08:00
|
|
|
-- got from http://lua-users.org/wiki/StringInterpolation
|
|
|
|
|
function interp(s, tab)
|
|
|
|
|
return (s:gsub("($%b{})", function(w)
|
|
|
|
|
return tab[w:sub(3, -2)] or w
|
|
|
|
|
end))
|
|
|
|
|
end
|
2021-09-04 13:14:01 +08:00
|
|
|
|
2021-09-04 16:40:29 +08:00
|
|
|
local function write_template(path, template, values)
|
2021-09-04 14:57:37 +08:00
|
|
|
print("[write template] " .. path)
|
2021-09-04 16:40:29 +08:00
|
|
|
local content = interp(template, values)
|
2021-09-04 14:57:37 +08:00
|
|
|
local file = io.open(path, "w")
|
|
|
|
|
file:write(content)
|
|
|
|
|
file:close()
|
|
|
|
|
end
|
2021-09-04 13:14:01 +08:00
|
|
|
|
|
|
|
|
local function build()
|
2021-09-05 08:04:49 +08:00
|
|
|
local templates = { "vim", "kitty", "alacritty", "wezterm", "lualine" }
|
2021-09-04 16:02:45 +08:00
|
|
|
for _, t in ipairs(templates) do
|
|
|
|
|
write_template(unpack(require("zenbones.build." .. t)))
|
|
|
|
|
end
|
2021-09-04 13:14:01 +08:00
|
|
|
end
|
|
|
|
|
|
|
|
|
|
return { build = build }
|