From 863983202ce4ef92d9e3a296a682535d157c245d Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Sat, 23 Jun 2018 17:22:23 -0700 Subject: Fixed up nomsupath behavior and refactored file stuff into its own file. --- lib/os.nom | 19 ++++++++++++++----- lib/version.nom | 1 + 2 files changed, 15 insertions(+), 5 deletions(-) create mode 100644 lib/version.nom (limited to 'lib') diff --git a/lib/os.nom b/lib/os.nom index be65370..8a27168 100644 --- a/lib/os.nom +++ b/lib/os.nom @@ -1,5 +1,10 @@ use "core" +action [path of Nomsu file %filename] + lua> ".." + for f in files.walk(\%filename) do return f end + barf "Could not find file: \%filename" + action [sh> %cmd] lua> ".." local result = io.popen(\%cmd) @@ -8,11 +13,15 @@ action [sh> %cmd] return contents action [read file %filename] - lua> ".." - local file = io.open(\%filename) - local contents = file:read("*a") - file:close() - return contents + =lua "files.read(\%filename)" + +compile [for file %f in %path %body] to + Lua ".." + for \(%f as lua expr) in files.walk(\(%path as lua expr)) do + \(%body as lua statements) + \(compile as: === next %f ===) + end + \(compile as: === stop %f ===) action [write to file %filename %text, to file %filename write %text] lua> ".." diff --git a/lib/version.nom b/lib/version.nom new file mode 100644 index 0000000..3b90888 --- /dev/null +++ b/lib/version.nom @@ -0,0 +1 @@ +lua> "NOMSU_LIB_VERSION = 2" -- cgit v1.2.3