Skip to content

Latest commit

 

History

History
47 lines (33 loc) · 1.21 KB

README.md

File metadata and controls

47 lines (33 loc) · 1.21 KB

Play CLI

Play CLI defines helpers to deal with UNIX command with Play Framework iteratees.

Getting Started

Add this SBT dependency:

"fr.greweb" %% "playcli" % "0.12"

Play CLI depends only on play-iteratee.

Some random examples:

import playcli._
val logs = CLI.enumerate("tail -f aLogFile")
/* Ok.stream(logs) */

val colorQuantize = CLI.pipe("convert - -colors 14 png:-")
/* Ok.stream(anImageEnum &> colorQuantize) */

val scaleVideoHalf = CLI.pipe("ffmpeg -i pipe:0 -vf scale=iw/2:-1 -f avi pipe:1")
/* Ok.stream(streamEnum &> scaleVideoHalf) */

// Don't concatenate CMD string, but use the Seq syntax:
val logs = CLI.enumerate(Seq("tail", "-f", myFilePath))
/* Ok.stream(logs) */

// A consume example
val events : Enumerator[String] = …
events &> 
  Enumerator.map(e => (e+"\n").map(_.toByte).toArray) |>>> 
  CLI.consume("externalLoggerCmd")

// 

… continue to the scala API