[main] inline exec

This commit is contained in:
Paul Campbell 2019-04-30 09:40:07 +01:00
parent c8c652fe2d
commit 598bd77a03

View file

@ -6,13 +6,10 @@ import cats.syntax.all._
object Main extends IOApp { object Main extends IOApp {
def exec(args: List[String]): IO[ExitCode] =
for {
ec <- IO(println("S3Thorp - hashed sync for s3")).as(ExitCode.Success)
} yield ec
override def run(args: List[String]): IO[ExitCode] = override def run(args: List[String]): IO[ExitCode] =
exec(args).guaranteeCase { (for {
ec <- IO(println("S3Thorp - hashed sync for s3")).as(ExitCode.Success)
} yield ec).guaranteeCase {
case Canceled => IO(println("Interrupted")) case Canceled => IO(println("Interrupted"))
case Error(e) => IO(println("ERROR: " + e)) case Error(e) => IO(println("ERROR: " + e))
case Completed => IO(println("Done")) case Completed => IO(println("Done"))