https://github.com/solidsnack/scaladon
Simple Scala console example
https://github.com/solidsnack/scaladon
console jar jvm repl sbt scala
Last synced: about 2 months ago
JSON representation
Simple Scala console example
- Host: GitHub
- URL: https://github.com/solidsnack/scaladon
- Owner: solidsnack
- License: apache-2.0
- Created: 2017-06-10T22:01:22.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2017-07-26T04:16:40.000Z (almost 9 years ago)
- Last Synced: 2025-10-10T10:25:13.779Z (8 months ago)
- Topics: console, jar, jvm, repl, sbt, scala
- Language: Scala
- Size: 36.1 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# `scaladon`
Embed a Scala interpreter in your application with `scaladon`.
See `li.pika.scaladon.Main` for an example of how to use the
`li.pika.scaladon.Engine`.
```bash
:; sbt assembly
...
[success] Total time: 12 s, completed Jul 7, 2017 8:03:11 PM
:; java -jar target/scala-*/uber.jar
Welcome to Scala 2.12.2 (Java HotSpot(TM) 64-Bit Server VM, Java 1.8.0_102).
Type in expressions for evaluation. Or try :help.
scala> val task = li.pika.scaladon.tasks.Task.settings()
task: scala.tools.nsc.Settings =
Settings {
-nc = true
-d = .
-deprecation = true
-usejavacp = true
-feature = true
}
```
# Configuring The Interpreter
The `li.pika.scaladon.Engine` allows one to set three settings:
```scala
case class Engine(bindings: Bindings = new SimpleBindings(),
prompt: Option[String] = None,
welcome: Option[String] = None) { ... }
```
The `bindings` apply for scripts while the `prompt` and `welcome` apply to the
interactive interpreter. (At present, `scaladon` is not able to set bindings
for the interactive interpreter.)