aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/os.nom19
-rw-r--r--lib/version.nom1
2 files changed, 15 insertions, 5 deletions
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"