Operators

replpp.Operators
object Operators

Operators to redirect output to files or pipe them into external commands / processes, inspired by unix shell redirection and pipe operators: >, >> and |. Naming convention: similar to scala.sys.process we prefix all operators with # to avoid naming clashes with more basic operators like > for greater-than-comparisons.

They are declared as extension types for Any and pretty-print the results using our PPrinter. List types (IterableOnce, java.lang.Iterable, Array, ...) are being unwrapped (only at the root level).

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any
Self type
Operators.type

Members list

Type members

Classlikes

case class ProcessResults(stdout: String, stderr: String)

output from an external command, e.g. when using #|

output from an external command, e.g. when using #|

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all

Value members

Concrete methods

def main(args: Array[String]): Unit
def pipeToCommand(value: String, commandAndArguments: Seq[String], inheritIO: Boolean): Try[ProcessResults]

Pipe output into an external process, i.e. pass the value into the command's InputStream. Executing an external command may fail, hence returning a Try.

Pipe output into an external process, i.e. pass the value into the command's InputStream. Executing an external command may fail, hence returning a Try.

Value parameters

inheritIO

: set to true for commands like less that are supposed to capture the entire IO

Attributes

Extensions

Extensions

extension (value: Any)(using Colors)
def #>(outFile: Path): Unit

Redirect output into file, overriding that file - similar to > redirection in unix.

Redirect output into file, overriding that file - similar to > redirection in unix.

Attributes

def #>(outFileName: String): Unit

Redirect output into file, overriding that file - similar to > redirection in unix.

Redirect output into file, overriding that file - similar to > redirection in unix.

Attributes

def #>>(outFile: Path): Unit

Redirect output into file, appending to that file - similar to >> redirection in unix.

Redirect output into file, appending to that file - similar to >> redirection in unix.

Attributes

def #>>(outFileName: String): Unit

Redirect output into file, appending to that file - similar to >> redirection in unix.

Redirect output into file, appending to that file - similar to >> redirection in unix.

Attributes

def #|(commandAndArguments: String*): String

Pipe output into an external process, i.e. pass the valueAsString into the command's InputStream. Returns a concatenation of the stdout and stderr of the external command. Executing an external command may fail, and this will throw an exception in that case. see #|^ for a variant that inherits IO (e.g. for less)

Pipe output into an external process, i.e. pass the valueAsString into the command's InputStream. Returns a concatenation of the stdout and stderr of the external command. Executing an external command may fail, and this will throw an exception in that case. see #|^ for a variant that inherits IO (e.g. for less)

Attributes

def #|^(commandAndArguments: String*): Unit

Pipe output into an external process, i.e. pass the valueAsString into the command's InputStream. Executing an external command may fail, and this will throw an exception in that case. This is a variant of #| which inherits IO (e.g. for less) - therefor it doesn't capture stdout/stderr.

Pipe output into an external process, i.e. pass the valueAsString into the command's InputStream. Executing an external command may fail, and this will throw an exception in that case. This is a variant of #| which inherits IO (e.g. for less) - therefor it doesn't capture stdout/stderr.

Attributes