From 364a41e2199f591954b17f518b85f28200fe10f5 Mon Sep 17 00:00:00 2001 From: "Erik C. Thauvin" Date: Sat, 30 Jul 2016 19:57:52 -0700 Subject: [PATCH] Added comments --- .../erik/kobalt/plugin/versioneye/Utils.kt | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/main/kotlin/net/thauvin/erik/kobalt/plugin/versioneye/Utils.kt b/src/main/kotlin/net/thauvin/erik/kobalt/plugin/versioneye/Utils.kt index 052a9f6..42d4063 100644 --- a/src/main/kotlin/net/thauvin/erik/kobalt/plugin/versioneye/Utils.kt +++ b/src/main/kotlin/net/thauvin/erik/kobalt/plugin/versioneye/Utils.kt @@ -36,12 +36,19 @@ import com.beust.kobalt.misc.log open class Utils { companion object { + // Match failure option in set + fun isFail(failOn: Set, match: Fail): Boolean { + return failOn.contains(match) + } + + // Log text if applicable fun log(text: StringBuilder, flag: Boolean, level: Int = 1) { if (flag && text.length > 0) { - log(level, text.toString()) + log(level, text) } } + // Pluralize text if applicable fun plural(text: String, count: Int, plural: String, singular: String = ""): String { if (count > 1) { return text + plural @@ -51,10 +58,11 @@ open class Utils { } - fun redLight(count: Int, fail: Boolean, colors: Boolean) : String { + fun redLight(count: Int, fail: Boolean, colors: Boolean): String { return redLight(count.toString(), count, fail, colors) } + // Green, yellow, red colored-text based on failure and count fun redLight(text: String, count: Int, fail: Boolean, colors: Boolean): String { if (colors) { if (fail && count > 0) { @@ -67,9 +75,5 @@ open class Utils { } return text } - - fun isFail(failOn: Set, match: Fail) : Boolean { - return failOn.contains(match) - } } } \ No newline at end of file