Skip to content

Commit aa98fa2

Browse files
committed
Update zio.
1 parent 3e3499a commit aa98fa2

2 files changed

Lines changed: 11 additions & 9 deletions

File tree

build.sbt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ javaOptions += "-Xmx8G"
1616

1717
testFrameworks += new TestFramework("zio.test.sbt.ZTestFramework")
1818

19-
val zioVersion = "1.0.6"
19+
val zioVersion = "1.0.9"
2020

2121
libraryDependencies ++= {
2222
Seq(

src/main/scala/org/renci/relationgraph/ZCaseApp.scala

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@ import caseapp.core.parser.Parser
66
import caseapp.core.util.Formatter
77
import caseapp.core.{Error, RemainingArgs}
88
import zio._
9-
import zio.console.{putStrLn, Console}
9+
import zio.console.{Console, putStrLn}
10+
11+
import java.io.IOException
1012

1113
/**
1214
* Adapted from caseapp.cats.IOCaseApp
@@ -23,13 +25,13 @@ abstract class ZCaseApp[T](implicit val parser0: Parser[T], val messages: Help[T
2325

2426
def run(options: T, remainingArgs: RemainingArgs): ZIO[ZEnv, Nothing, ExitCode]
2527

26-
private[this] def error(message: Error): ZIO[Console, Nothing, ExitCode] =
28+
private[this] def error(message: Error): ZIO[Console, IOException, ExitCode] =
2729
putStrLn(message.message).as(ExitCode.failure)
2830

29-
private[this] def helpAsked: ZIO[Console, Nothing, ExitCode] =
31+
private[this] def helpAsked: ZIO[Console, IOException, ExitCode] =
3032
putStrLn(messages.withHelp.help).as(ExitCode.success)
3133

32-
private[this] def usageAsked: ZIO[Console, Nothing, ExitCode] =
34+
private[this] def usageAsked: ZIO[Console, IOException, ExitCode] =
3335
putStrLn(messages.withHelp.usage).as(ExitCode.success)
3436

3537
/**
@@ -64,10 +66,10 @@ abstract class ZCaseApp[T](implicit val parser0: Parser[T], val messages: Help[T
6466

6567
override def run(args: List[String]): ZIO[ZEnv, Nothing, ExitCode] =
6668
parser.withHelp.detailedParse(expandArgs(args), stopAtFirstUnrecognized) match {
67-
case Left(err) => error(err)
68-
case Right((WithHelp(_, true, _), _)) => helpAsked
69-
case Right((WithHelp(true, _, _), _)) => usageAsked
70-
case Right((WithHelp(_, _, Left(err)), _)) => error(err)
69+
case Left(err) => error(err).orDie
70+
case Right((WithHelp(_, true, _), _)) => helpAsked.orDie
71+
case Right((WithHelp(true, _, _), _)) => usageAsked.orDie
72+
case Right((WithHelp(_, _, Left(err)), _)) => error(err).orDie
7173
case Right((WithHelp(_, _, Right(t)), remainingArgs)) => run(t, remainingArgs)
7274
}
7375

0 commit comments

Comments
 (0)