Skip to content

Commit

Permalink
Use table-based approach for creating custom targets
Browse files Browse the repository at this point in the history
This way, things like uninstall 'just work'.
  • Loading branch information
josephwright committed Jan 14, 2019
1 parent 4a2bca0 commit 66ae92b
Showing 1 changed file with 6 additions and 41 deletions.
47 changes: 6 additions & 41 deletions l3kernel/build.lua
Expand Up @@ -173,47 +173,12 @@ function format()
return 0
end

-- l3kernel does all of the targets itself
function main(target, files)
local errorlevel = 0
if target == "check" then
errorlevel = check(files)
elseif target == "clean" then
clean()
elseif target == "cmdcheck" then
errorlevel = cmdcheck()
elseif target == "ctan" then
errorlevel = ctan(true)
elseif target == "doc" then
errorlevel = doc(files)
elseif target == "format" then
errorlevel = format()
elseif target == "install" then
install()
elseif target == "save" then
if next(files) then
errorlevel = save(files)
else
help()
end
elseif target == "tag" then
if options["names"] and #options["names"] == 1 then
tag(options["names"][1])
else
print("Tag name required")
help()
exit(1)
end
elseif target == "unpack" then
errorlevel = unpack()
elseif target == "version" then
version()
else
help()
end
os.exit(errorlevel)
end

target_list = target_list or { }
target_list.format =
{
func = format,
desc = "Creat l3formats"
}

-- Find and run the build system
kpse.set_program_name("kpsewhich")
Expand Down

0 comments on commit 66ae92b

Please sign in to comment.