diff options
| author | Bruce Hill <bruce@bruce-hill.com> | 2019-01-14 15:42:48 -0800 |
|---|---|---|
| committer | Bruce Hill <bruce@bruce-hill.com> | 2019-01-14 15:43:24 -0800 |
| commit | c1c32688a4afc43f6addb99b8b5fa878944a70e3 (patch) | |
| tree | c886f21b5b08a9053aa74fcba4b241dae5ede76d /lib/os.nom | |
| parent | 2309b696fc34b24f05f6658b94f9105ca8ee76e4 (diff) | |
Overhaul in progress, mostly working. Moved all the nomsu packages into
lib/, including core/*. Changes to how nomsu environments and importing
work.
Diffstat (limited to 'lib/os.nom')
| -rw-r--r-- | lib/os.nom | 49 |
1 files changed, 0 insertions, 49 deletions
diff --git a/lib/os.nom b/lib/os.nom deleted file mode 100644 index 87b3426..0000000 --- a/lib/os.nom +++ /dev/null @@ -1,49 +0,0 @@ -#!/usr/bin/env nomsu -V6.14 -# - This file defines some actions that interact with the operating system and filesystem. - -externally (files for $path) means: - $files = (=lua "Files.list(\$path)") - if $files: - $files = (List $files) - return $files - -externally (=sh $cmd) means: - lua> (" - local result = io.popen(\$cmd) - local contents = result:read("*a") - result:close() - return contents - ") - -external $(sh> $) = $os.execute - -test: - read file "lib/os.nom" - -external $(read file $filename) = $Files.read -externally [ - write to file $filename $text, to file $filename write $text - write $text to file $filename -] all mean: - unless ($filename != "stdin"): - fail "Cannot write to stdin" - - lua> (" - local file = io.open(\$filename, 'w') - file:write(\$text) - file:close() - ") - -externally (source lines of $tree) means: - $source = ($tree.source if ($tree is syntax tree) else $tree) - $file = (read file $source.filename) - return - [ - : for $ in ($file, line number at $source.start) to - $file, line number at $source.stop - ..: add ($file, line $) - ], joined with "\n" - -external $(spoof file $text) = $Files.spoof -external $(spoof file $filename = $text) = $Files.spoof |
