Skip to content
This repository has been archived by the owner on Aug 23, 2022. It is now read-only.

Commit

Permalink
fix: empty string display is wrong
Browse files Browse the repository at this point in the history
  • Loading branch information
shomatan committed Sep 14, 2018
1 parent 4a2d089 commit 5b4dfb3
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
11 changes: 5 additions & 6 deletions src/main/scala/com/nulabinc/backlog/c2b/App.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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 =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 5b4dfb3

Please sign in to comment.