File tree Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -107,7 +107,7 @@ The below features are all demonstrated using the REPL but also work when runnin
107
107
108
108
### execute code at the start with ` --runBefore `
109
109
```
110
- ./srp --runBefore ' import Byte.MaxValue'
110
+ ./srp --runBefore " import Byte.MaxValue"
111
111
112
112
scala> MaxValue
113
113
val res0: Int = 127
@@ -116,7 +116,7 @@ val res0: Int = 127
116
116
You can specify this parameter multiple times, the given statements will be executed in the given order.
117
117
118
118
If you want to execute some code _ every single time_ you start a session, just write it to ` ~/.scala-repl-pp.sc `
119
- ```
119
+ ``` bash
120
120
echo ' import Short.MaxValue' > ~ /.scala-repl-pp.sc
121
121
122
122
./srp
@@ -125,6 +125,15 @@ scala> MaxValue
125
125
val res0: Int = 32767
126
126
```
127
127
128
+ If the code you want to execute on startup is in a file, you can use your shell tooling:
129
+ ``` bash
130
+ echo ' import Int.MaxValue' > /tmp/runBeforeFile.sc
131
+ ./srp --runBefore " $( cat /tmp/runBeforeFile.sc) "
132
+
133
+ scala> MaxValue
134
+ val res0: Int = 2147483647
135
+ ```
136
+
128
137
### ` --predef ` : add source files to the classpath
129
138
Additional source files that are compiled added to the classpath, but unlike ` runBefore ` not executed straight away can be provided via ` --predef ` .
130
139
```
You can’t perform that action at this time.
0 commit comments