-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #154 from alexarchambault/remove-cli
Remove cli
- Loading branch information
Showing
19 changed files
with
157 additions
and
430 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,3 +2,4 @@ target/ | |
.bsp/ | ||
metals.sbt | ||
.vscode/ | ||
.bloop/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 0 additions & 10 deletions
10
cli/src/main/resources/META-INF/native-image/native-image.properties
This file was deleted.
Oops, something went wrong.
18 changes: 0 additions & 18 deletions
18
cli/src/main/resources/META-INF/native-image/reflect-config.json
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
package ammrunner.cli | ||
|
||
import java.io.File | ||
|
||
import ammrunner.{AmmoniteFetcher, Command, Versions, VersionsOption} | ||
|
||
object AmmRunner { | ||
|
||
def command( | ||
ammVersion: Option[String], | ||
scalaVersion: Option[String], | ||
args: Seq[String] | ||
): Command = { | ||
|
||
val scriptPathOpt = args | ||
.iterator | ||
.filter(!_.startsWith("-")) | ||
.filter(_.endsWith(".sc")) | ||
.map(new File(_)) | ||
.filter(_.isFile) | ||
.toStream | ||
.headOption | ||
|
||
val versionsOpt = VersionsOption(ammVersion, scalaVersion) | ||
val versions = scriptPathOpt match { | ||
case None => | ||
versionsOpt.getOrElse(Versions.default()) | ||
|
||
case Some(script) => | ||
versionsOpt | ||
.orElse(VersionsOption.fromScript(script)) | ||
.getOrElse(Versions.default()) | ||
} | ||
val command = AmmoniteFetcher(versions).command() match { | ||
case Left(e) => throw new Exception("Error getting Ammonite class path", e) | ||
case Right(cmd) => cmd | ||
} | ||
|
||
command.withArgs(args) | ||
} | ||
} |
Oops, something went wrong.