diff options
author | Karl Berry <karl@freefriends.org> | 2017-04-19 23:04:15 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2017-04-19 23:04:15 +0000 |
commit | f74161ca4e7eb3c5af9afcbe92522ae3b58987c1 (patch) | |
tree | 3c30a13df5ac7968195c85070a2b074578e669d2 /Master/texmf-dist/scripts/context/lua/mtx-cache.lua | |
parent | 1d5a55ac8f5506a7ae9cfca52f4b588182e199d4 (diff) |
context beta/cont-tmf.zip (Apr 16 12:55)
git-svn-id: svn://tug.org/texlive/trunk@43931 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/scripts/context/lua/mtx-cache.lua')
-rw-r--r-- | Master/texmf-dist/scripts/context/lua/mtx-cache.lua | 31 |
1 files changed, 20 insertions, 11 deletions
diff --git a/Master/texmf-dist/scripts/context/lua/mtx-cache.lua b/Master/texmf-dist/scripts/context/lua/mtx-cache.lua index bff1cb4968f..56d3df188d2 100644 --- a/Master/texmf-dist/scripts/context/lua/mtx-cache.lua +++ b/Master/texmf-dist/scripts/context/lua/mtx-cache.lua @@ -11,7 +11,7 @@ local helpinfo = [[ <application> <metadata> <entry name="name">mtx-cache</entry> - <entry name="detail">ConTeXt & MetaTeX Cache Management</entry> + <entry name="detail">ConTeXt & MetaTeX Cache Management</entry> <entry name="version">0.10</entry> </metadata> <flags> @@ -22,13 +22,19 @@ local helpinfo = [[ <flag name="list"><short>show cache</short></flag> </subcategory> <subcategory> - <flag name="all"><short>all (not yet implemented)</short></flag> + <flag name="fonts"><short>only wipe fonts</short></flag> </subcategory> </category> </flags> </application> ]] + +local find = string.find +local filesuffix, replacesuffix = file.suffix, file.replacesuffix +local isfile = lfs.isfile +local remove = os.remove + local application = logs.application { name = "mtx-cache", banner = "ConTeXt & MetaTeX Cache Management 0.10", @@ -45,7 +51,7 @@ local function collect(path) local tmas, tmcs, rest = { }, { }, { } for i=1,#all do local name = all[i] - local suffix = file.suffix(name) + local suffix = filesuffix(name) if suffix == "tma" then tmas[#tmas+1] = name elseif suffix == "tmc" then @@ -70,19 +76,22 @@ end local function purge(banner,path,list,all) report("%s: %s",banner,path) report() + local fonts = environment.argument("fonts") local n = 0 for i=1,#list do local filename = list[i] - if string.find(filename,"luatex%-cache") then -- safeguard - if all then - os.remove(filename) + if find(filename,"luatex%-cache") then -- safeguard + if fonts and not find(filename,"fonts") then + -- skip + elseif all then + remove(filename) n = n + 1 - else - local suffix = file.suffix(filename) + elseif not fonts or find(filename,"fonts") then + local suffix = filesuffix(filename) if suffix == "tma" then - local checkname = file.replacesuffix(filename,"tma","tmc") - if lfs.isfile(checkname) then - os.remove(filename) + local checkname = replacesuffix(filename,"tma","tmc") + if isfile(checkname) then + remove(filename) n = n + 1 end end |