Skip to content

gre/playCLI

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

87 Commits
 
 
 
 
 
 
 
 

Repository files navigation

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

About

Play Framework Iteratees + UNIX pipe library

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages