aboutsummaryrefslogtreecommitdiff
path: root/src/create.lua
blob: e4bb2024c592a26a5a2adfb460edc122de07a51f (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() and not path:is_directory() then
		error('template does not exist.')
	end

	local builder = Builder:from_template(path)

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