More template flexibility
As of deets 0.1, you can now also populate Cosmo template variables through Lua code. For example:
/tmp/silly.lua:
require("utils-grep")
local intel = grep_program_output("VGA.*Intel","lspci")
file.file({"/tmp/garbage"}, {
ensure = "present",
owner = "root",
group = "root",
mode = "755",
source = file.cosmotemplate("/tmp/silly.cosmo", intel)
})
/tmp/silly.cosmo:
# On $systeminfo|hostname, we might have used the following information
# to populate this config file.
#
# We did not.
$map{$v|1}[[# $it]]
Then run sudo luau --rectify /tmp/silly.lua
and your /tmp/garbage should be equally useless whether or not you have an Intel video card.
Posted on 2011-07-22