https://github.com/alexarchambault/ammonite-runner
Library and CLI to fetch and run Ammonite scripts
https://github.com/alexarchambault/ammonite-runner
ammonite ammonite-scripts cli repl scala
Last synced: 3 months ago
JSON representation
Library and CLI to fetch and run Ammonite scripts
- Host: GitHub
- URL: https://github.com/alexarchambault/ammonite-runner
- Owner: alexarchambault
- Created: 2020-03-20T13:35:09.000Z (about 5 years ago)
- Default Branch: main
- Last Pushed: 2024-08-21T12:54:13.000Z (10 months ago)
- Last Synced: 2025-02-27T07:50:38.695Z (4 months ago)
- Topics: ammonite, ammonite-scripts, cli, repl, scala
- Language: Scala
- Homepage:
- Size: 174 KB
- Stars: 16
- Watchers: 3
- Forks: 5
- Open Issues: 12
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# ammonite-runner
[](https://travis-ci.org/alexarchambault/ammonite-runner)
[](https://maven-badges.herokuapp.com/maven-central/io.github.alexarchambault.ammonite/ammonite-runner_2.13)Library and CLI to fetch and run Ammonite scripts
## Library
```scala
libraryDependencies += "io.github.alexarchambault.ammonite" %% "ammonite-runner" % "0.2.0"
```The latest version is [](https://maven-badges.herokuapp.com/maven-central/io.github.alexarchambault.ammonite/ammonite-runner_2.13).
Example of use
```scala
import ammrunner._val file: java.io.File = ???
val versions = VersionsOption.fromScript(file)
// Latest matching scala / Ammonite versions if none are set in script
.getOrElse(Versions.default())val command = AmmoniteFetcher(versions)
.command()
.fold(throw _, identity)val proc: Process = command
.withArgs(Seq(file.getAbsolutePath))
.run()val retCode: Int = proc.waitFor()
```## CLI
Example of use
```
$ cs launch io.github.alexarchambault.ammonite::ammonite-runner-cli:latest.release -- script.sc
```## License
Copyright (c) 2020, Alexandre Archambault.
All files in this repository can be used either under the Apache 2.0 license.