@@ -14,6 +14,7 @@ case class Config(
1414 command : Option [String ] = None ,
1515 params : Map [String , String ] = Map .empty,
1616 predefFiles : Seq [Path ] = Nil ,
17+ runBefore : Seq [String ] = Nil ,
1718 additionalClasspathEntries : Seq [String ] = Seq .empty,
1819 addPlugin : Option [String ] = None ,
1920 rmPlugin : Option [String ] = None ,
@@ -73,6 +74,13 @@ trait BridgeBase extends InteractiveShell with ScriptExecution with PluginHandli
7374 .action((x, c) => c.copy(predefFiles = c.predefFiles :+ x))
7475 .text(" given source files will be compiled and added to classpath - this may be passed multiple times" )
7576
77+ opt[String ](" runBefore" )
78+ .valueName(" 'import Int.MaxValue'" )
79+ .unbounded()
80+ .optional()
81+ .action((x, c) => c.copy(runBefore = c.runBefore :+ x))
82+ .text(" given code will be executed on startup - this may be passed multiple times" )
83+
7684 opt[String ](" classpathEntry" )
7785 .valueName(" path/to/classpath" )
7886 .unbounded()
@@ -223,6 +231,7 @@ trait BridgeBase extends InteractiveShell with ScriptExecution with PluginHandli
223231 config.forInputPath.foreach { name =>
224232 builder += s """ openForInputPath(" $name") """ .stripMargin
225233 }
234+ builder ++= config.runBefore
226235 builder.result()
227236 }
228237
0 commit comments