diff --git a/biopet-framework/src/main/scala/nl/lumc/sasc/biopet/core/BiopetExecutable.scala b/biopet-framework/src/main/scala/nl/lumc/sasc/biopet/core/BiopetExecutable.scala index d84c4b815f2c2d98c13a42ae6ffeeeab40935c97..af0d91dff9b5434d0f17c22193655a09007e215e 100644 --- a/biopet-framework/src/main/scala/nl/lumc/sasc/biopet/core/BiopetExecutable.scala +++ b/biopet-framework/src/main/scala/nl/lumc/sasc/biopet/core/BiopetExecutable.scala @@ -1,5 +1,7 @@ package nl.lumc.sasc.biopet.core +import java.util.Properties + object BiopetExecutable { val modules: Map[String, List[MainCommand]] = Map( @@ -47,6 +49,9 @@ object BiopetExecutable { | |%s | + |Subcommands: + | - version + | |Questions or comments? Email sasc@lumc.nl or check out the project page at https://git.lumc.nl/biopet/biopet.git """.stripMargin.format(modules.keys.mkString(","), getVersion, usage) } @@ -69,6 +74,9 @@ object BiopetExecutable { } args match { + case Array("version") => { + println("version: " + getVersion) + } case Array(module, name, passArgs @ _*) => { getCommand(module, name).main(passArgs.toArray) } @@ -84,6 +92,12 @@ object BiopetExecutable { } def getVersion = { - getClass.getPackage.getImplementationVersion + getClass.getPackage.getImplementationVersion + " (" + getCommitHash + ")" + } + + def getCommitHash = { + val prop = new Properties() + prop.load(getClass.getClassLoader.getResourceAsStream("git.properties")) + prop.getProperty("git.commit.id.abbrev") } } diff --git a/biopet-framework/src/main/scala/nl/lumc/sasc/biopet/core/BiopetQCommandLine.scala b/biopet-framework/src/main/scala/nl/lumc/sasc/biopet/core/BiopetQCommandLine.scala index b7527d4bf5734cea82d562c7c27695024d122d89..be66dabeb24369c32b50743f7e655c231b64aec6 100644 --- a/biopet-framework/src/main/scala/nl/lumc/sasc/biopet/core/BiopetQCommandLine.scala +++ b/biopet-framework/src/main/scala/nl/lumc/sasc/biopet/core/BiopetQCommandLine.scala @@ -274,14 +274,16 @@ class BiopetQCommandLine extends CommandLineProgram with Logging { } private def createQueueHeader(): Seq[String] = { - Seq(String.format("Queue v%s, Compiled %s", getQueueVersion, getBuildTimestamp), - "Copyright (c) 2012 The Broad Institute", - "For support and documentation go to http://www.broadinstitute.org/gatk") + Seq("Biopet version: " + BiopetExecutable.getVersion,"", + "Based on GATK Queue", +// String.format("Queue v%s, Compiled %s", getQueueVersion, getBuildTimestamp), + "Copyright (c) 2012 The Broad Institute", + "For support and documentation go to http://www.broadinstitute.org/gatk") } private def getQueueVersion: String = { val stingResources: ResourceBundle = TextFormattingUtils.loadResourceBundle("StingText") - + if (stingResources.containsKey("org.broadinstitute.sting.queue.QueueVersion.version")) { stingResources.getString("org.broadinstitute.sting.queue.QueueVersion.version") } else { diff --git a/biopet-framework/src/main/scala/nl/lumc/sasc/biopet/core/ToolCommand.scala b/biopet-framework/src/main/scala/nl/lumc/sasc/biopet/core/ToolCommand.scala index cb65caf8eca62f8c8a6ddde07b18fd5565a8a853..98e59c41372c1dfcb573faf5293300bbe6574701 100644 --- a/biopet-framework/src/main/scala/nl/lumc/sasc/biopet/core/ToolCommand.scala +++ b/biopet-framework/src/main/scala/nl/lumc/sasc/biopet/core/ToolCommand.scala @@ -30,9 +30,15 @@ trait ToolCommand extends MainCommand { } } opt[Unit]('h', "help") foreach { _ => - System.err.println(this.usage); sys.exit(1)} text("Print usage") + System.err.println(this.usage) + sys.exit(1) + } text("Print usage") + opt[Unit]('v', "version") foreach { _ => + System.err.println("Version: " + BiopetExecutable.getVersion) + sys.exit(1) + } text("Print version") } - + type Args <: AbstractArgs type OptParser <: AbstractOptParser