diff options
Diffstat (limited to 'Master/texmf-dist/scripts/context/lua/mtx-scite.lua')
-rw-r--r-- | Master/texmf-dist/scripts/context/lua/mtx-scite.lua | 56 |
1 files changed, 31 insertions, 25 deletions
diff --git a/Master/texmf-dist/scripts/context/lua/mtx-scite.lua b/Master/texmf-dist/scripts/context/lua/mtx-scite.lua index d5f0a5344e5..0ac09b01702 100644 --- a/Master/texmf-dist/scripts/context/lua/mtx-scite.lua +++ b/Master/texmf-dist/scripts/context/lua/mtx-scite.lua @@ -9,6 +9,19 @@ if not modules then modules = { } end modules ['mtx-scite'] = { -- todo: append to global properties else order of loading problem -- linux problem ... files are under root protection so we need --install +local helpinfo = [[ +--start [--verbose] start scite +--test report what will happen +]] + +local application = logs.application { + name = "mtx-scite", + banner = "Scite Startup Script 1.00", + helpinfo = helpinfo, +} + +local report = application.report + scripts = scripts or { } scripts.scite = scripts.scite or { } @@ -30,11 +43,11 @@ function scripts.scite.start(indeed) local binpaths = file.split_path(os.getenv("PATH")) or file.split_path(os.getenv("path")) for i=1,#scitesignals do local scitesignal = scitesignals[i] - local scitepath = resolvers.find_file(scitesignal,"other text files") or "" + local scitepath = resolvers.findfile(scitesignal,"other text files") or "" if scitepath ~= "" then scitepath = file.dirname(scitepath) -- data if scitepath == "" then - scitepath = resolvers.clean_path(lfs.currentdir()) + scitepath = resolvers.cleanpath(lfs.currentdir()) else usedsignal, datapath = scitesignal, scitepath break @@ -42,11 +55,11 @@ function scripts.scite.start(indeed) end end if not datapath or datapath == "" then - logs.simple("invalid datapath, maybe you need to regenerate the file database") + report("invalid datapath, maybe you need to regenerate the file database") return false end if not binpaths or #binpaths == 0 then - logs.simple("invalid binpath") + report("invalid binpath") return false end for i=1,#binpaths do @@ -57,15 +70,15 @@ function scripts.scite.start(indeed) end end if not fullname then - logs.simple("unable to locate %s",workname) + report("unable to locate %s",workname) return false end local properties = dir.glob(file.join(datapath,"*.properties")) local luafiles = dir.glob(file.join(datapath,"*.lua")) - local extrafont = resolvers.find_file(screenfont,"truetype font") or "" + local extrafont = resolvers.findfile(screenfont,"truetype font") or "" local pragmafound = dir.glob(file.join(datapath,"pragma.properties")) if userpath == "" then - logs.simple("unable to figure out userpath") + report("unable to figure out userpath") return false end local verbose = environment.argument("verbose") @@ -120,47 +133,40 @@ function scripts.scite.start(indeed) end end if not indeed or verbose then - logs.simple("used signal: %s", usedsignal) - logs.simple("data path : %s", datapath) - logs.simple("full name : %s", fullname) - logs.simple("user path : %s", userpath) - logs.simple("extra font : %s", extrafont) + report("used signal: %s", usedsignal) + report("data path : %s", datapath) + report("full name : %s", fullname) + report("user path : %s", userpath) + report("extra font : %s", extrafont) end if #logdata > 0 then - logs.simple("") + report("") for k=1,#logdata do local v = logdata[k] - logs.simple(v[1],v[2]) + report(v[1],v[2]) end end if indeed then if #tobecopied > 0 then - logs.simple("warning : copying updated files") + report("warning : copying updated files") for i=1,#tobecopied do local what = tobecopied[i] - logs.simple("copying : '%s' => '%s'",what[1],what[2]) + report("copying : '%s' => '%s'",what[1],what[2]) file.copy(what[1],what[2]) end end if propfiledone then - logs.simple("saving : '%s'",userpropfile) + report("saving : '%s'",userpropfile) io.savedata(fullpropfile,userpropdata) end os.launch(fullname) end end -logs.extendbanner("Scite Startup Script 1.00",true) - -messages.help = [[ ---start [--verbose] start scite ---test report what will happen -]] - if environment.argument("start") then scripts.scite.start(true) elseif environment.argument("test") then scripts.scite.start() else - logs.help(messages.help) + application.help() end |