diff options
| author | Bruce Hill <bruce@bruce-hill.com> | 2018-11-26 16:16:08 -0800 |
|---|---|---|
| committer | Bruce Hill <bruce@bruce-hill.com> | 2018-11-26 16:17:07 -0800 |
| commit | cbbe6b1c14faf85c20dee4c481723cf0e468e0e8 (patch) | |
| tree | 2906c14f9f054bd68e2c9a56a87a8d346f647d08 /nomsu_environment.lua | |
| parent | 1a794c64871fa044c3024a7771ee4123e800d3b2 (diff) | |
Updated and fixed the command line API. Introduced the "-t tool" flag
for more concisely running tools, removed the "-I file" and replaced it
with "-m files..."
Diffstat (limited to 'nomsu_environment.lua')
| -rw-r--r-- | nomsu_environment.lua | 36 |
1 files changed, 13 insertions, 23 deletions
diff --git a/nomsu_environment.lua b/nomsu_environment.lua index 5838a1d..fc5ab31 100644 --- a/nomsu_environment.lua +++ b/nomsu_environment.lua @@ -312,35 +312,25 @@ local nomsu_environment = Importer({ local _continue_0 = false repeat do - local files = Files.list(nomsupath .. "/" .. path) + local full_path = nomsupath == "." and path or nomsupath .. "/" .. path + local files = Files.list(full_path) if not (files) then _continue_0 = true break end for _index_0 = 1, #files do - local _continue_1 = false - repeat - local filename = files[_index_0] - if not (filename == "stdin" or filename:match("%.nom$")) then - _continue_1 = true - break - end - local lua_filename = filename:gsub("%.nom$", ".lua") - local code - if optimization ~= 0 and Files.read(lua_filename) then - local file = Files.read(lua_filename) - code = LuaCode:from(Source(filename, 1, #file), file) - else - local file = Files.read(filename) - code = NomsuCode:from(Source(filename, 1, #file), file) - end - environment.run_1_in(code, mod) - did_anything = true - _continue_1 = true - until true - if not _continue_1 then - break + local filename = files[_index_0] + local lua_filename = filename:gsub("%.nom$", ".lua") + local code + if optimization ~= 0 and Files.read(lua_filename) then + local file = Files.read(lua_filename) + code = LuaCode:from(Source(filename, 1, #file), file) + else + local file = Files.read(filename) + code = NomsuCode:from(Source(filename, 1, #file), file) end + environment.run_1_in(code, mod) + did_anything = true end break end |
