Skip to content

Commit

Permalink
Use appropriate console colors in envs help
Browse files Browse the repository at this point in the history
  • Loading branch information
Gedochao committed Jul 30, 2024
1 parent 9d525ae commit 3f470ff
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions modules/core/src/main/scala/scala/build/internals/EnvsUtil.scala
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package scala.build.internals

import scala.build.internals.ConsoleUtils.ScalaCliConsole

object EnvsUtil {
def helpMessage(isPower: Boolean): String =
s"""The following is the list of environment variables used and recognized by Scala CLI.
Expand All @@ -22,6 +24,9 @@ object EnvsUtil {
* @param passToIde
* Whether to pass this variable to the IDE/BSP client (true by default, should only be
* disabled for env vars which aren't safe to save on disk)
* @param requiresPower
* Whether this variable is related to a feature that requires power mode; also used for
* internal toggles and such
*/
case class EnvVar(
name: String,
Expand All @@ -31,8 +36,11 @@ object EnvsUtil {
) {
def valueOpt: Option[String] = Option(System.getenv(name))
override def toString: String = s"$name=${valueOpt.getOrElse("")}"
def helpMessage(spaces: String): String =
s"$name$spaces${if requiresPower then "(power) " else ""}$description"
def helpMessage(spaces: String): String = {
val powerString =
if requiresPower then s"${ScalaCliConsole.GRAY}(power)${Console.RESET} " else ""
s"${Console.YELLOW}$name${Console.RESET}$spaces$powerString$description"
}
}
object EnvVar {
trait EnvVarGroup {
Expand Down

0 comments on commit 3f470ff

Please sign in to comment.