Permalink
Browse files

Tweak echo kernel info

  • Loading branch information...
alexarchambault committed Oct 4, 2018
1 parent 9aff985 commit d173ba5feadeada9fa4cd5c0d2edfe6fc3900fee
Showing with 28 additions and 2 deletions.
  1. +1 −0 build.sbt
  2. +27 −2 modules/echo/src/main/scala/almond/echo/EchoInterpreter.scala
View
@@ -119,6 +119,7 @@ lazy val echo = project
.dependsOn(kernel, test % Test)
.settings(
shared,
generatePropertyFile("almond/echo.properties"),
testSettings,
libraryDependencies += Deps.caseApp
)
@@ -1,5 +1,7 @@
package almond.echo
import java.util.Properties
import almond.interpreter.{Completion, ExecuteResult, Interpreter}
import almond.interpreter.api.{DisplayData, OutputHandler}
import almond.interpreter.input.InputManager
@@ -10,15 +12,16 @@ final class EchoInterpreter extends Interpreter {
def kernelInfo(): KernelInfo =
KernelInfo(
"echo",
"0.1",
EchoInterpreter.version,
KernelInfo.LanguageInfo(
"echo",
"1.0",
"text/echo",
"echo",
"text" // ???
),
"Echo kernel"
s"""Echo kernel ${EchoInterpreter.version}
|Java ${sys.props.getOrElse("java.version", "[unknown]")}""".stripMargin
)
@volatile private var count = 0
@@ -68,3 +71,25 @@ final class EchoInterpreter extends Interpreter {
}
}
object EchoInterpreter {
lazy val version = {
val p = new Properties
try {
p.load(
getClass
.getClassLoader
.getResourceAsStream("almond/echo.properties")
)
} catch {
case _: NullPointerException =>
}
Option(p.getProperty("version"))
.getOrElse("[unknown]")
}
}

0 comments on commit d173ba5

Please sign in to comment.