All Downloads are FREE. Search and download functionalities are using the official Maven repository.

au.csiro.variantspark.cmd.Echoable.scala Maven / Gradle / Ivy

The newest version!
package au.csiro.variantspark.cmd

import org.kohsuke.args4j.Option

trait Echoable {
  @Option(name = "-v", required = false, usage = "Be verbose", aliases = Array("--verbose"))
  val beVerbose: Boolean = false

  @Option(name = "-s", required = false, usage = "Be silent", aliases = Array("--silent"))
  val beSilent: Boolean = false

  def isSilent: Boolean = beSilent
  def isEcho: Boolean = !isSilent
  def isVerbose: Boolean = !beSilent && beVerbose

  def warn(msg: => String) {
    echo(s"Warning: ${msg}")
  }

  def echo(msg: => String) {
    if (isEcho) {
      println(msg)
    }
  }

  def verbose(msg: => String) {
    if (isVerbose) {
      println(msg)
    }
  }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy