aboutsummaryrefslogtreecommitdiff
path: root/examples/shell/shell.tm
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2025-04-06 16:07:23 -0400
committerBruce Hill <bruce@bruce-hill.com>2025-04-06 16:07:23 -0400
commit6782cc5570e194791ca6cdd695b88897e9145564 (patch)
treea428e9d954aca251212ec1cf15bd35e0badce630 /examples/shell/shell.tm
parent448e805293989b06e07878a4a87fdd378f7c6e02 (diff)
No more colons for blocks
Diffstat (limited to 'examples/shell/shell.tm')
-rw-r--r--examples/shell/shell.tm40
1 files changed, 20 insertions, 20 deletions
diff --git a/examples/shell/shell.tm b/examples/shell/shell.tm
index 816d63a2..da03f843 100644
--- a/examples/shell/shell.tm
+++ b/examples/shell/shell.tm
@@ -1,44 +1,44 @@
use commands
-lang Shell:
- convert(text:Text -> Shell):
+lang Shell
+ convert(text:Text -> Shell)
return Shell.from_text("'" ++ text.replace($/'/, `'"'"'`) ++ "'")
- convert(texts:[Text] -> Shell):
+ convert(texts:[Text] -> Shell)
return Shell.from_text(" ".join([Shell(t).text for t in texts]))
- convert(path:Path -> Shell):
+ convert(path:Path -> Shell)
return Shell(Text(path.expand_home()))
- convert(paths:[Path] -> Shell):
+ convert(paths:[Path] -> Shell)
return Shell.from_text(" ".join([Shell(Text(p)).text for p in paths]))
- convert(n:Int -> Shell): return Shell.from_text(Text(n))
- convert(n:Int64 -> Shell): return Shell.from_text(Text(n))
- convert(n:Int32 -> Shell): return Shell.from_text(Text(n))
- convert(n:Int16 -> Shell): return Shell.from_text(Text(n))
- convert(n:Int8 -> Shell): return Shell.from_text(Text(n))
- convert(n:Num -> Shell): return Shell.from_text(Text(n))
- convert(n:Num32 -> Shell): return Shell.from_text(Text(n))
+ convert(n:Int -> Shell) return Shell.from_text(Text(n))
+ convert(n:Int64 -> Shell) return Shell.from_text(Text(n))
+ convert(n:Int32 -> Shell) return Shell.from_text(Text(n))
+ convert(n:Int16 -> Shell) return Shell.from_text(Text(n))
+ convert(n:Int8 -> Shell) return Shell.from_text(Text(n))
+ convert(n:Num -> Shell) return Shell.from_text(Text(n))
+ convert(n:Num32 -> Shell) return Shell.from_text(Text(n))
- func command(shell:Shell -> Command):
+ func command(shell:Shell -> Command)
return Command("sh", ["-c", shell.text])
- func result(shell:Shell, input="", input_bytes:[Byte]=[] -> ProgramResult):
+ func result(shell:Shell, input="", input_bytes:[Byte]=[] -> ProgramResult)
return shell.command().result(input=input, input_bytes=input_bytes)
- func run(shell:Shell -> ExitType):
+ func run(shell:Shell -> ExitType)
return shell.command().run()
- func get_output(shell:Shell, input="", trim_newline=yes -> Text?):
+ func get_output(shell:Shell, input="", trim_newline=yes -> Text?)
return shell.command().get_output(input=input, trim_newline=trim_newline)
- func get_output_bytes(shell:Shell, input="", input_bytes:[Byte]=[] -> [Byte]?):
+ 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?)?):
+ func by_line(shell:Shell -> func(->Text?)?)
return shell.command().by_line()
-func main(command:Shell):
- for line in command.by_line()!:
+func main(command:Shell)
+ for line in command.by_line()!
>> line