Load a file on startup into Scala 3 REPL

An example in file test.scala:

//> using scala 3.4

export Stuff.*

object Stuff:
  def hello = println(msg)
  val msg = "hello"

Start repl with scala-cli repl test.scala and you have the stuff in Stuff available without import:

Welcome to Scala 3.4.1 (17.0.8.1, Java OpenJDK 64-Bit Server VM).
Type in expressions for evaluation. Or try :help.
                                                                                
scala> hello
hello
                                                                                
scala> msg
val res0: String = hello
1 Like