mirror of
https://mzte.de/git/LordMZTE/dotfiles.git
synced 2024-11-15 14:33:26 +01:00
35 lines
850 B
Lua
35 lines
850 B
Lua
cg.addPath ".config"
|
|
cg.addPath ".local"
|
|
cg.addPath ".ssh"
|
|
cg.addPath ".cargo"
|
|
cg.addPath "etc"
|
|
|
|
for k, v in pairs(require "cg_opts") do
|
|
cg.opt[k] = v
|
|
end
|
|
|
|
-- This function is called in templates to allow adding device-specific configs.
|
|
cg.opt.getDeviceConf = function(id)
|
|
local path = os.getenv "HOME" .. "/.config/mzte_localconf/" .. id
|
|
local file = io.open(path, "r")
|
|
|
|
if file == nil then
|
|
return ""
|
|
end
|
|
|
|
return file:read "*a"
|
|
end
|
|
|
|
-- Get the output of a system command
|
|
cg.opt.system = function(cmd)
|
|
local handle = io.popen(cmd)
|
|
if handle == nil then
|
|
error("Failed to spawn process" .. cmd)
|
|
end
|
|
return handle:read("*a"):gsub("%s+", "")
|
|
end
|
|
|
|
-- Compile the input as lua. Meant to be used as a post-processor.
|
|
cg.opt.luaCompile = function(lua)
|
|
return string.dump(loadstring(lua), true)
|
|
end
|