diff --git a/src/main/scala/com/nulabinc/backlog/c2b/App.scala b/src/main/scala/com/nulabinc/backlog/c2b/App.scala index 2990a0c..14d0458 100644 --- a/src/main/scala/com/nulabinc/backlog/c2b/App.scala +++ b/src/main/scala/com/nulabinc/backlog/c2b/App.scala @@ -157,23 +157,22 @@ object App extends Logger { private def checkReleaseVersion(appVersion: String): AppProgram[Unit] = for { result <- AppDSL.fromHttp(HttpDSL.get(GithubRelease.url)) - message <- result match { + _ <- result match { case Right(source) => val latestVersion = GithubRelease.parseLatestVersion(source) if (latestVersion != appVersion) { - AppDSL.pure(s""" + val message = s""" |-------------------------------------------------- |${Messages("warn.not_latest_version", latestVersion, appVersion)} |-------------------------------------------------- |""".stripMargin - ) + AppDSL.fromConsole(ConsoleDSL.printWarning(message)) } else - AppDSL.pure("") + AppDSL.pure(()) case Left(error) => log.error(error.toString) - AppDSL.pure("") + AppDSL.pure(()) } - _ <- AppDSL.fromConsole(ConsoleDSL.printWarning(message)) } yield () private def exit(exitCode: Int): Unit = diff --git a/src/main/scala/com/nulabinc/backlog/c2b/interpreters/ConsoleInterpreter.scala b/src/main/scala/com/nulabinc/backlog/c2b/interpreters/ConsoleInterpreter.scala index 6f86af0..398e0f2 100644 --- a/src/main/scala/com/nulabinc/backlog/c2b/interpreters/ConsoleInterpreter.scala +++ b/src/main/scala/com/nulabinc/backlog/c2b/interpreters/ConsoleInterpreter.scala @@ -12,16 +12,18 @@ class ConsoleInterpreter extends (ConsoleADT ~> Task) { program.foldMap(this) def print(string: String): Task[Unit] = Task { - ConsoleOut.println(string) - () + if (string.nonEmpty) + ConsoleOut.println(string) } def printBold(string: String): Task[Unit] = Task { - ConsoleOut.boldln(string) + if (string.nonEmpty) + ConsoleOut.boldln(string) } def printWarning(string: String): Task[Unit] = Task { - ConsoleOut.warning(string) + if (string.nonEmpty) + ConsoleOut.warning(string) } def read(printMessage: String): Task[String] = Task {