aboutsummaryrefslogtreecommitdiff
path: root/examples/shell
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2025-03-19 16:17:44 -0400
committerBruce Hill <bruce@bruce-hill.com>2025-03-19 16:17:44 -0400
commitf3b8529e01f66f4743d26a62237706a09a2f1f71 (patch)
treef71748ab096e22016e529c601a5ec2e0e1c61170 /examples/shell
parente7dc0ec85c8b591ae27fba369d35e26ec6c1b7d3 (diff)
Add command and shell :by_line()
Diffstat (limited to 'examples/shell')
-rw-r--r--examples/shell/shell.tm6
1 files changed, 6 insertions, 0 deletions
diff --git a/examples/shell/shell.tm b/examples/shell/shell.tm
index cf5fcd2e..f1e2308d 100644
--- a/examples/shell/shell.tm
+++ b/examples/shell/shell.tm
@@ -33,3 +33,9 @@ lang Shell:
func get_output_bytes(shell:Shell, input="", input_bytes=[:Byte] -> [Byte]?):
return shell:command():get_output_bytes(input=input, input_bytes=input_bytes)
+ func by_line(shell:Shell -> func(->Text?)?):
+ return shell:command():by_line()
+
+func main(command:Shell):
+ for line in command:by_line()!:
+ >> line