diff options
author | Karl Berry <karl@freefriends.org> | 2018-08-03 21:16:27 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2018-08-03 21:16:27 +0000 |
commit | 5010c435d5c9e266b90f68227f41610b19b88465 (patch) | |
tree | 6b809d1324d4fac1a92e21c3920a5b459c088dc8 /Master/texmf-dist/scripts/l3build/l3build-help.lua | |
parent | 97b66e90dd2d069b12f64e3339c7486b748d222d (diff) |
l3build (3aug18)
git-svn-id: svn://tug.org/texlive/trunk@48340 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/scripts/l3build/l3build-help.lua')
-rw-r--r-- | Master/texmf-dist/scripts/l3build/l3build-help.lua | 61 |
1 files changed, 32 insertions, 29 deletions
diff --git a/Master/texmf-dist/scripts/l3build/l3build-help.lua b/Master/texmf-dist/scripts/l3build/l3build-help.lua index c7050c44210..18caf87daae 100644 --- a/Master/texmf-dist/scripts/l3build/l3build-help.lua +++ b/Master/texmf-dist/scripts/l3build/l3build-help.lua @@ -22,6 +22,11 @@ for those people who are interested. --]] +local insert = table.insert +local match = string.match +local rep = string.rep +local sort = table.sort + function version() print( "\n" .. @@ -31,46 +36,44 @@ function version() end function help() + local function setup_list(list) + local longest = 0 + for k,v in pairs(list) do + if k:len() > longest then + longest = k:len() + end + end + -- Sort the options + local t = { } + for k,_ in pairs(list) do + insert(t, k) + end + sort(t) + return longest,t + end + local scriptname = "l3build" - if not string.match(arg[0], "l3build(%.lua)$") then + if not match(arg[0], "l3build(%.lua)$") then scriptname = arg[0] end print("usage: " .. scriptname .. " <command> [<options>] [<names>]") print("") print("The most commonly used l3build commands are:") - if testfiledir ~= "" then - print(" check Run all automated tests") - end - print(" clean Clean out directory tree") - if module == "" or bundle == "" then - print(" ctan Create CTAN-ready archive") - end - print(" doc Typesets all documentation files") - print(" install Installs files into the local texmf tree") - if module ~= "" and testfiledir ~= "" then - print(" save Saves test validation log") + local longest,t = setup_list(target_list) + for _,k in ipairs(t) do + local target = target_list[k] + local filler = rep(" ", longest - k:len() + 1) + if target["desc"] then + print(" " .. k .. filler .. target["desc"]) + end end - print(" tag Update release tags in files") - print(" uninstall Uninstalls files from the local texmf tree") - print(" unpack Unpacks the source files into the build tree") print("") print("Valid options are:") - local longest = 0 - for k,v in pairs(option_list) do - if k:len() > longest then - longest = k:len() - end - end - -- Sort the options - local t = { } - for k,_ in pairs(option_list) do - table.insert(t, k) - end - table.sort(t) + local longest,t = setup_list(option_list) for _,k in ipairs(t) do local opt = option_list[k] - local filler = string.rep(" ", longest - k:len() + 1) - if opt["desc"] then -- Skip --help as it has no desc + local filler = rep(" ", longest - k:len() + 1) + if opt["desc"] then if opt["short"] then print(" --" .. k .. "|-" .. opt["short"] .. filler .. opt["desc"]) else |