aboutsummaryrefslogtreecommitdiff
path: root/src/main/scala/firrtl/options/StageUtils.scala
blob: c3867c7ed3b217e255048779a29476a0306b2918 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
// SPDX-License-Identifier: Apache-2.0

package firrtl.options

/** Utilities related to working with a [[Stage]] */
object StageUtils {

  /** Print a warning message (in yellow)
    * @param message error message
    */
  def dramaticWarning(message: String): Unit = {
    println(Console.YELLOW + "-" * 78)
    println(s"Warning: $message")
    println("-" * 78 + Console.RESET)
  }

  /** Print an error message (in red)
    * @param message error message
    * @note This does not stop the Driver.
    */
  def dramaticError(message: String): Unit = {
    println(Console.RED + "-" * 78)
    println(s"Error: $message")
    println("-" * 78 + Console.RESET)
  }

  /** Generate a message suggesting that the user look at the usage text.
    * @param message the error message
    */
  def dramaticUsageError(message: String): Unit =
    dramaticError(s"""|$message
                      |Try --help for more information.""".stripMargin)

}