aboutsummaryrefslogtreecommitdiff
path: root/src/create.lua
blob: 19ba7e8624cd1c17276547fa21c6fb1dea7a7221 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
return function()
	local args = require('arg') {
		strict = false,
		{ name = "target" },
		{
			name = "template",
			description = "template name or path to build.lua",
			kind = "property",
			required = true,
		},
	}

	local path = manager.get(args.template) or Path:new(args.template)

	if not path:exists() then
		error('template does not exist.')
	end

	local builder = Builder:from_template(path)

	local instance = builder:build(args)
	instance:save_to(args.target)
end