diff options
Diffstat (limited to 'lib/shell')
| -rw-r--r-- | lib/shell/CHANGES.md | 5 | ||||
| -rw-r--r-- | lib/shell/README.md | 13 | ||||
| -rw-r--r-- | lib/shell/shell.tm | 44 |
3 files changed, 0 insertions, 62 deletions
diff --git a/lib/shell/CHANGES.md b/lib/shell/CHANGES.md deleted file mode 100644 index 42ae752c..00000000 --- a/lib/shell/CHANGES.md +++ /dev/null @@ -1,5 +0,0 @@ -# Version History - -## v1.0 - -Initial version diff --git a/lib/shell/README.md b/lib/shell/README.md deleted file mode 100644 index d4bcd42e..00000000 --- a/lib/shell/README.md +++ /dev/null @@ -1,13 +0,0 @@ -# Shell - -This module defines a `lang` for running shell scripts: - -```tomo -use shell_v1.0 - ->> $Shell" - seq 5 - echo DONE -":get_output() -= "1$\n2$\n3$\n4$\n5$\nDONE" -``` diff --git a/lib/shell/shell.tm b/lib/shell/shell.tm deleted file mode 100644 index f9476161..00000000 --- a/lib/shell/shell.tm +++ /dev/null @@ -1,44 +0,0 @@ -use commands_v1.0 - -lang Shell - convert(text:Text -> Shell) - return Shell.from_text("'" ++ text.replace($/'/, `'"'"'`) ++ "'") - - convert(texts:[Text] -> Shell) - return Shell.from_text(" ".join([Shell(t).text for t in texts])) - - convert(path:Path -> Shell) - return Shell(Text(path.expand_home())) - - 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)) - - func command(shell:Shell -> Command) - return Command("sh", ["-c", shell.text]) - - func result(shell:Shell, input="", input_bytes:[Byte]=[] -> ProgramResult) - return shell.command().result(input=input, input_bytes=input_bytes) - - func run(shell:Shell -> ExitType) - return shell.command().run() - - 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]?) - 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 |
