diff --git a/kobaltw b/kobaltw index 1fd228db..b27b3d89 100755 --- a/kobaltw +++ b/kobaltw @@ -1,2 +1 @@ -#!/usr/bin/env bash java -jar $(dirname $0)/kobalt/wrapper/kobalt-wrapper.jar $* diff --git a/src/main/kotlin/com/beust/kobalt/AsciiArt.kt b/src/main/kotlin/com/beust/kobalt/AsciiArt.kt index c80b035c..6cf5d5d9 100644 --- a/src/main/kotlin/com/beust/kobalt/AsciiArt.kt +++ b/src/main/kotlin/com/beust/kobalt/AsciiArt.kt @@ -73,6 +73,23 @@ class AsciiArt { val spaces = diff / 2 + 1 return fill(spaces) + s + fill(spaces + if (diff % 2 == 1) 1 else 0) } + + const val RESET = "\u001B[0m" + const val BLACK = "\u001B[30m" + const val RED = "\u001B[31m" + const val GREEN = "\u001B[32m" + const val YELLOW = "\u001B[33m"; + const val BLUE = "\u001B[34m" + const val PURPLE = "\u001B[35m" + const val CYAN = "\u001B[36m" + const val WHITE = "\u001B[37m" + + private fun wrap(s: String, color: String) = color + s + RESET + private fun red(s: String) = wrap(s, RED) + private fun yellow(s: String) = wrap(s, YELLOW) + + fun taskColor(s: String) = yellow(s) + fun errorColor(s: String) = red(s) } } diff --git a/src/main/kotlin/com/beust/kobalt/internal/TaskManager.kt b/src/main/kotlin/com/beust/kobalt/internal/TaskManager.kt index 8f0806ae..bf3eb960 100644 --- a/src/main/kotlin/com/beust/kobalt/internal/TaskManager.kt +++ b/src/main/kotlin/com/beust/kobalt/internal/TaskManager.kt @@ -303,7 +303,7 @@ class TaskWorker(val tasks: List, val dryRun: Boolean) : IWorker { if (tasks.size > 0) { tasks[0].let { - log(1, AsciiArt.horizontalSingleLine + " ${it.project.name}:${it.name}") + log(1, AsciiArt.taskColor(AsciiArt.horizontalSingleLine + " ${it.project.name}:${it.name}")) } } var success = true diff --git a/src/main/kotlin/com/beust/kobalt/misc/KobaltLogger.kt b/src/main/kotlin/com/beust/kobalt/misc/KobaltLogger.kt index 8aecebf1..0796dd9f 100644 --- a/src/main/kotlin/com/beust/kobalt/misc/KobaltLogger.kt +++ b/src/main/kotlin/com/beust/kobalt/misc/KobaltLogger.kt @@ -1,5 +1,6 @@ package com.beust.kobalt.misc +import com.beust.kobalt.AsciiArt import com.beust.kobalt.KobaltException import com.beust.kobalt.api.Kobalt import java.text.SimpleDateFormat @@ -66,7 +67,7 @@ class Logger(val dev: Boolean) { val shortMessage = "***** E $text " + if (docUrl != null) " Documentation: $docUrl" else "" val longMessage = "*****\n***** ERROR $text\n*****" - println(getPattern("E", shortMessage, longMessage, tag)) + println(AsciiArt.errorColor(getPattern("E", shortMessage, longMessage, tag))) if (KobaltLogger.LOG_LEVEL > 1) { e?.printStackTrace() }