case class Main(predefCode: String = "", predefFile: Option[Path] = None, defaultPredef: Boolean = true, storageBackend: Storage = new Storage.Folder(Defaults.ammoniteHome), wd: Path = os.pwd, welcomeBanner: Option[String] = Some(Defaults.welcomeBanner), inputStream: InputStream = System.in, outputStream: OutputStream = System.out, errorStream: OutputStream = System.err, verboseOutput: Boolean = true, remoteLogging: Boolean = true, colors: Colors = Colors.Default, replCodeWrapper: CodeWrapper = DefaultCodeWrapper, scriptCodeWrapper: CodeWrapper = DefaultCodeWrapper, alreadyLoadedDependencies: Seq[Dependency] = Defaults.alreadyLoadedDependencies(), importHooks: Map[Seq[String], ImportHook] = ImportHook.defaults, compilerBuilder: CompilerBuilder = ammonite.compiler.CompilerBuilder, parser: () => Parser = () => ammonite.compiler.Parsers, classPathWhitelist: Set[Seq[String]] = Set.empty) extends Product with Serializable
Contains the various entry points to the Ammonite REPL.
Configuration of the basic REPL is done by passing in arguments when constructing the Main instance, and the various entrypoints such as run runScript and so on are methods on that instance.
It is more or less equivalent to the ammonite.repl.Repl object itself, and has a similar set of parameters, but does not have any of the ammonite.repl.Repl's implementation-related code and provides a more convenient set of entry-points that a user can call.
Note that the instantiateRepl function generates a new Repl every time it is called!
- predefCode
Any additional code you want to run before the REPL session starts. Can contain multiple blocks separated by
@
s- defaultPredef
Do you want to include the "standard" predef imports provided by Ammonite? These include tools like
time
,grep
, the|
or|?
pipes from ammonite-ops, and other helpers. Can be disabled to give a clean namespace for you to fill using your own predef.- storageBackend
Where will all of Ammonite's persistent data get stored? Things like any
predef.sc
file, compilation/ivy caches, etc.. Defaults include Storage.Folder and Storage.InMemory, though you can create your own.- wd
The working directory of the REPL; when it load scripts, where the scripts will be considered relative to when assigning them packages
- inputStream
Where input to the Repl is coming from, typically System.in, but it could come from somewhere else e.g. across the network in the case of the SshdRepl
- outputStream
Primary output of code run using Ammonite
- errorStream
Error output when things go bad, typically System.err; also gets sent miscellaneous info messages that aren't strictly part of the REPL or script's output
- Alphabetic
- By Inheritance
- Main
- Serializable
- Product
- Equals
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Instance Constructors
- new Main(predefCode: String = "", predefFile: Option[Path] = None, defaultPredef: Boolean = true, storageBackend: Storage = new Storage.Folder(Defaults.ammoniteHome), wd: Path = os.pwd, welcomeBanner: Option[String] = Some(Defaults.welcomeBanner), inputStream: InputStream = System.in, outputStream: OutputStream = System.out, errorStream: OutputStream = System.err, verboseOutput: Boolean = true, remoteLogging: Boolean = true, colors: Colors = Colors.Default, replCodeWrapper: CodeWrapper = DefaultCodeWrapper, scriptCodeWrapper: CodeWrapper = DefaultCodeWrapper, alreadyLoadedDependencies: Seq[Dependency] = Defaults.alreadyLoadedDependencies(), importHooks: Map[Seq[String], ImportHook] = ImportHook.defaults, compilerBuilder: CompilerBuilder = ammonite.compiler.CompilerBuilder, parser: () => Parser = () => ammonite.compiler.Parsers, classPathWhitelist: Set[Seq[String]] = Set.empty)
- predefCode
Any additional code you want to run before the REPL session starts. Can contain multiple blocks separated by
@
s- defaultPredef
Do you want to include the "standard" predef imports provided by Ammonite? These include tools like
time
,grep
, the|
or|?
pipes from ammonite-ops, and other helpers. Can be disabled to give a clean namespace for you to fill using your own predef.- storageBackend
Where will all of Ammonite's persistent data get stored? Things like any
predef.sc
file, compilation/ivy caches, etc.. Defaults include Storage.Folder and Storage.InMemory, though you can create your own.- wd
The working directory of the REPL; when it load scripts, where the scripts will be considered relative to when assigning them packages
- inputStream
Where input to the Repl is coming from, typically System.in, but it could come from somewhere else e.g. across the network in the case of the SshdRepl
- outputStream
Primary output of code run using Ammonite
- errorStream
Error output when things go bad, typically System.err; also gets sent miscellaneous info messages that aren't strictly part of the REPL or script's output
Value Members
- final def !=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def ##(): Int
- Definition Classes
- AnyRef → Any
- final def ==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- val alreadyLoadedDependencies: Seq[Dependency]
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- val classPathWhitelist: Set[Seq[String]]
- def clone(): AnyRef
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @native()
- val colors: Colors
- val compilerBuilder: CompilerBuilder
- val defaultPredef: Boolean
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- val errorStream: OutputStream
- def finalize(): Unit
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.Throwable])
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- val importHooks: Map[Seq[String], ImportHook]
- def initialClassLoader: ClassLoader
- val inputStream: InputStream
- def instantiateInterpreter(): Either[(Failing, Seq[(Watchable, Long)]), Interpreter]
- def instantiateRepl(replArgs: IndexedSeq[Bind[_]] = Vector.empty): Either[(Failure, Seq[(Path, Long)]), Repl]
Instantiates an ammonite.Repl using the configuration
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- def loadedPredefFile: Either[(Failure, Seq[(Path, Long)]), Option[PredefInfo]]
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- val outputStream: OutputStream
- val parser: () => Parser
- val predefCode: String
- val predefFile: Option[Path]
- def productElementNames: Iterator[String]
- Definition Classes
- Product
- val replCodeWrapper: CodeWrapper
- def run(replArgs: Bind[_]*): (Res[Any], Seq[(Watchable, Long)])
Run the REPL, with any additional bindings you wish to provide.
Run the REPL, with any additional bindings you wish to provide.
Returns an
Any
representing any value that the user passed into theexit
call when closing the REPL (defaults to(): Unit
). Also returns a sequence of paths that were watched as a result of this REPL run, in case you wish to re-start the REPL when any of them change. - def runCode(code: String): (Res[Imports], Seq[(Watchable, Long)])
Run a snippet of code
- def runScript(path: Path, scriptArgs: Seq[String]): (Res[Any], Seq[(Watchable, Long)])
Run a Scala script file! takes the path to the file as well as an array of
args
and a map of keywordkwargs
to pass to that file. - val scriptCodeWrapper: CodeWrapper
- val storageBackend: Storage
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- val verboseOutput: Boolean
- final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException]) @native()
- val wd: Path
- val welcomeBanner: Option[String]
Deprecated Value Members
- val remoteLogging: Boolean
- Annotations
- @deprecated
- Deprecated
(Since version Ammonite 2.3.0) remoteLogging has been removed, do not use this field