From edc648ae9559babf012be835c9370871e7196459 Mon Sep 17 00:00:00 2001 From: Mike Hearn Date: Thu, 22 Dec 2016 11:37:27 +0100 Subject: [PATCH] Wish our users a merry Christmas and a happy new year. --- core/src/main/kotlin/net/corda/core/utilities/Emoji.kt | 2 ++ node/src/main/kotlin/net/corda/node/Main.kt | 10 +++++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/core/src/main/kotlin/net/corda/core/utilities/Emoji.kt b/core/src/main/kotlin/net/corda/core/utilities/Emoji.kt index 3a31d5faad..add37b2cb2 100644 --- a/core/src/main/kotlin/net/corda/core/utilities/Emoji.kt +++ b/core/src/main/kotlin/net/corda/core/utilities/Emoji.kt @@ -7,6 +7,7 @@ object Emoji { // Unfortunately only Apple has a terminal that can do colour emoji AND an emoji font installed by default. val hasEmojiTerminal by lazy { System.getenv("TERM_PROGRAM") == "Apple_Terminal" } + const val CODE_SANTA_CLAUS = "\ud83c\udf85" const val CODE_DIAMOND = "\ud83d\udd37" const val CODE_BAG_OF_CASH = "\ud83d\udcb0" const val CODE_NEWSPAPER = "\ud83d\udcf0" @@ -22,6 +23,7 @@ object Emoji { */ val emojiMode = ThreadLocal() + val santaClaus: String get() = if (emojiMode.get() != null) "$CODE_SANTA_CLAUS " else "" val diamond: String get() = if (emojiMode.get() != null) "$CODE_DIAMOND " else "" val bagOfCash: String get() = if (emojiMode.get() != null) "$CODE_BAG_OF_CASH " else "" val newspaper: String get() = if (emojiMode.get() != null) "$CODE_NEWSPAPER " else "" diff --git a/node/src/main/kotlin/net/corda/node/Main.kt b/node/src/main/kotlin/net/corda/node/Main.kt index 307e3266a6..1d66216ac1 100644 --- a/node/src/main/kotlin/net/corda/node/Main.kt +++ b/node/src/main/kotlin/net/corda/node/Main.kt @@ -17,6 +17,7 @@ import org.slf4j.LoggerFactory import java.lang.management.ManagementFactory import java.net.InetAddress import java.nio.file.Paths +import java.time.LocalDate import kotlin.system.exitProcess private var renderBasicInfoToConsole = true @@ -122,6 +123,13 @@ private fun printPluginsAndServices(node: Node) { } private fun messageOfTheDay(): Pair { + // TODO: Remove this next year. + val today = LocalDate.now() + if (today.isAfter(LocalDate.of(2016, 12, 20)) && today.isBefore(LocalDate.of(2017, 1, 3))) { + val claus = if (Emoji.hasEmojiTerminal) Emoji.santaClaus else "" + return Pair("The Corda team wishes you a very merry", "christmas and a happy new year! $claus") + } + val messages = arrayListOf( "The only distributed ledger that pays\nhomage to Pac Man in its logo.", "You know, I was a banker once ...\nbut I lost interest. ${Emoji.bagOfCash}", @@ -151,7 +159,7 @@ private fun drawBanner() { / ____/ _________/ /___ _ / / __ / ___/ __ / __ `/ """).fgBrightBlue().a(msg1).newline().fgBrightRed().a( "/ /___ /_/ / / / /_/ / /_/ / ").fgBrightBlue().a(msg2).newline().fgBrightRed().a( -"""\____/ /_/ \__,_/\__,_/""").reset().newline().newline().fgBrightDefault(). +"""\____/ /_/ \__,_/\__,_/""").reset().newline().newline().fgBrightDefault().bold(). a("--- DEVELOPER SNAPSHOT ------------------------------------------------------------").newline().reset()) }