aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorBruce Hill <bitbucket@bruce-hill.com>2018-06-14 22:17:26 -0700
committerBruce Hill <bitbucket@bruce-hill.com>2018-06-14 22:17:37 -0700
commit49f1eb3d08caf7605046373b7b3a001f28aa8aab (patch)
tree2894703fd312bd4202a3cbe225d19a958e2f24b2 /lib
parent82cfd3e54b5910843c091a9fb6ef3ad6b64ba757 (diff)
Reshuffling some files.
Diffstat (limited to 'lib')
-rw-r--r--lib/os.nom22
1 files changed, 22 insertions, 0 deletions
diff --git a/lib/os.nom b/lib/os.nom
new file mode 100644
index 0000000..be65370
--- /dev/null
+++ b/lib/os.nom
@@ -0,0 +1,22 @@
+use "core"
+
+action [sh> %cmd]
+ lua> ".."
+ local result = io.popen(\%cmd)
+ local contents = result:read("*a")
+ result:close()
+ return contents
+
+action [read file %filename]
+ lua> ".."
+ local file = io.open(\%filename)
+ local contents = file:read("*a")
+ file:close()
+ return contents
+
+action [write to file %filename %text, to file %filename write %text]
+ lua> ".."
+ local file = io.open(\%filename, 'w')
+ file:write(\%text)
+ file:close()
+