Skip to content

Commit

Permalink
Add version in CLI
Browse files Browse the repository at this point in the history
  • Loading branch information
mgdigital committed Jun 3, 2019
1 parent 59013ae commit 4457358
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/cli/main/scala/chromaprint/cli/Command.scala
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ object Command {
private[chromaprint] lazy val args: decline.Command[Args] =
decline.Command(
name = "chromaprint",
header = "Chromaprint CLI"
header = s"Chromaprint CLI v${chromaprint.version}"
)(Parser.args)

def create
Expand Down
9 changes: 9 additions & 0 deletions src/core/main/scala/chromaprint/package.scala
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
import scala.io.Source

package object chromaprint {

lazy val version: String =
Source.fromURL(getClass.getResource("/version.properties")).
mkString.
split("^version=", 2).
lift(1).
getOrElse{throw new RuntimeException("Cannot parse version number")}

def discard(evaluateForSideEffectOnly: Any): Unit = {
val _: Any = evaluateForSideEffectOnly
() //Return unit to prevent warning due to discarding value
Expand Down

0 comments on commit 4457358

Please sign in to comment.