You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
## Change the default sub-command to `repl` when no args are passed
11
+
12
+
We no longer default to the `help` sub-command when no arguments are passed. Starting with `0.1.13` running Scala CLI with no args will launch the `repl`.
13
+
14
+
```
15
+
$ scala-cli -S 3
16
+
Welcome to Scala 3.1.3 (17.0.3, Java OpenJDK 64-Bit Server VM).
17
+
Type in expressions for evaluation. Or try :help.
18
+
19
+
scala>
20
+
```
21
+
22
+
When inputs are provided, Scala CLI defaults to the `run` sub-command, as before.
23
+
24
+
```
25
+
$ cat hello.sc
26
+
println("Hello World")
27
+
$ scala-cli hello.sc
28
+
Hello World
29
+
```
30
+
31
+
This change was added by [@Gedochao](https://github.com/Gedochao) in [#1268](https://github.com/VirtusLab/scala-cli/pull/1268)
32
+
33
+
## Marking the project's workspace root with the `project.settings.scala` file
34
+
35
+
Scala CLI now supports marking the workspace root directory with an optional configuration file: `project.settings.scala`. The workspace root determines where the `.bsp` and `.scala-build` directories will be saved (which mostly affects what path should be opened in your IDE to import the Scala CLI project through BSP).
36
+
37
+
The settings file is also the recommended input for your project's `using directives`. Otherwise, it functions similarly to other `.scala` sources.
38
+
39
+
```
40
+
$ cat project.settings.scala
41
+
//> using scala "2.13.4"
42
+
$ cat hello.sc
43
+
println(util.Properties.versionString)
44
+
$ scala-cli hello.sc .
45
+
version 2.13.4
46
+
```
47
+
48
+
To see how exactly is the root directory resolved, see [this document](https://github.com/VirtusLab/scala-cli/blob/932c942b78bc35fc0906f2f9e2f6a0c56bef712b/website/docs/reference/root-dir.md)
49
+
50
+
Added in [#1260](https://github.com/VirtusLab/scala-cli/pull/1260) by [@wleczny](https://github.com/wleczny)
51
+
52
+
## Scala CLI is now built with Scala 3.2.0
53
+
54
+
We now rely on Scala `3.2.0` as the default internal Scala version used to build the project.
55
+
56
+
This change was added by [@lwronski](https://github.com/lwronski) in [#1314](https://github.com/VirtusLab/scala-cli/pull/1314)
57
+
58
+
## Add resources support for Scala Native
59
+
60
+
Scala CLI now allows embedding resources (by default) in a Scala Native binary with the `--native` flag.
61
+
62
+
```
63
+
$ cat resources/scala-native/foo.c
64
+
int foo(int i) {
65
+
return i + 42;
66
+
}
67
+
$ cat hello.scala
68
+
//> using platform "native"
69
+
//> using resourceDir "resources"
70
+
71
+
import scalanative.unsafe.*
72
+
73
+
@extern
74
+
def foo(int: CInt): CInt = extern
75
+
76
+
@main def main =
77
+
println(foo(3))
78
+
$ scala-cli hello.scala --native
79
+
45
80
+
```
81
+
82
+
Added in [#812](https://github.com/VirtusLab/scala-cli/pull/812) by [@jchyb](https://github.com/jchyb)
83
+
84
+
## Default to the `run` sub-command instead of `repl` when the `-e`, `--execute-script`, `--execute-scala` or `--execute-java` options are passed.
85
+
86
+
Even though we default to the `repl` sub-command when no arguments are passed to Scala CLI, an exception to that rule is when a snippet is passed with one of the following options: `-e`, `--execute-script`, `--execute-scala` or `--execute-java`. In that case, the passed snippets are treated as inputs to be executed and switch the default to the `run` sub-command.
87
+
```
88
+
$ scala-cli -e 'println("Hello")'
89
+
Hello
90
+
```
91
+
92
+
If you still want to pass a snippet to the `repl`, you can either pass the `repl` sub-command explicitly or use one of the following options, as before: `--script-snippet`, `--scala-snippet` or `--java-snippet`.
93
+
```
94
+
$ scala-cli --script-snippet 'println("Hello")'
95
+
Welcome to Scala 3.1.3 (17.0.2, Java OpenJDK 64-Bit Server VM).
96
+
Type in expressions for evaluation. Or try :help.
97
+
98
+
scala> snippet_sc.main(Array.empty)
99
+
Hello
100
+
```
101
+
This change was introduced to make the `-e` option backwards compatible with the `scala` command.
102
+
103
+
Added in [#1313](https://github.com/VirtusLab/scala-cli/pull/1313) by [@Gedochao](https://github.com/Gedochao)
104
+
105
+
## Work in progress
106
+
107
+
### Support for Markdown (experimental)
108
+
109
+
Scala CLI can now accept `.md` inputs and run/compile a snippet of Scala code inside the markdown. Markdown sources are ignored by default unless passed explicitly as inputs. You can also enable including non-explicit `.md` inputs by passing the `--enable-markdown` option.
110
+
111
+
Plain `scala` snippets are treated similarly to `.sc` scripts which can be run by `scala-cli`:
112
+
113
+
````markdown
114
+
$ cat Example.md
115
+
This is a simple example of an `.md` file with a Scala snippet.
116
+
117
+
```scala
118
+
val message = "Hello from Markdown"
119
+
println(message)
120
+
```
121
+
````
122
+
123
+
```
124
+
scala-cli Example.md
125
+
Hello from Markdown
126
+
```
127
+
128
+
See [this document](https://github.com/VirtusLab/scala-cli/blob/5f15ada41fbdcce9b9efd93bd63d513e3476a69a/website/docs/guides/markdown.md) for more details about the experimental Markdown support.
129
+
130
+
Added in [#1268](https://github.com/VirtusLab/scala-cli/pull/1268) by [@Gedochao](https://github.com/Gedochao)
131
+
132
+
## Add `--python` option for the `run` sub-command (experimental)
133
+
134
+
The `run` sub-command can now run ScalaPy when the `--python` option is passed.
135
+
136
+
```
137
+
$ cat helloscalapy.sc
138
+
import py.SeqConverters
139
+
val len = py.Dynamic.global.len(List(0, 2, 3).toPythonProxy)
140
+
println(s"Length is $len")
141
+
$ scala-cli helloscalapy.sc --python -S 2.13
142
+
Length is 3
143
+
```
144
+
145
+
Added in [#1295](https://github.com/VirtusLab/scala-cli/pull/1295) by [@alexarchambault](https://github.com/alexarchambault)
146
+
147
+
## Other changes
148
+
149
+
#### Documentation
150
+
151
+
* Correct using directives on configuration.md by [@megri](https://github.com/megri) in [#1278](https://github.com/VirtusLab/scala-cli/pull/1278)
152
+
* Improve dependencies doc by [@Gedochao](https://github.com/Gedochao) in [#1287](https://github.com/VirtusLab/scala-cli/pull/1287)
153
+
154
+
### Fixes
155
+
156
+
* Fix path to sourceMappingURL by [@lwronski](https://github.com/lwronski) in [#1286](https://github.com/VirtusLab/scala-cli/pull/1286)
157
+
158
+
#### Build and internal changes
159
+
160
+
* Improve the error message for when a build's main class is ambiguous by [@Gedochao](https://github.com/Gedochao) in [#1323](https://github.com/VirtusLab/scala-cli/pull/1323)
161
+
* Improve the error message for unsupported Scala version with Ammonite by [@Gedochao](https://github.com/Gedochao) in [#1327](https://github.com/VirtusLab/scala-cli/pull/1327)
162
+
* Detect ARM64 macs when downloading coursier launcher by [@keynmol](https://github.com/keynmol) in [#1282](https://github.com/VirtusLab/scala-cli/pull/1282)
163
+
* Make test("...".only) work again in RunTestDefinitions by [alexarchambault](https://github.com/alexarchambault) in [#1294](https://github.com/VirtusLab/scala-cli/pull/1294)
164
+
* Use os-lib short-hand method trim when possible by [alexarchambault](https://github.com/alexarchambault) in [#1334](https://github.com/VirtusLab/scala-cli/pull/1334)
165
+
* Add missing repl tests by [alexarchambault](https://github.com/alexarchambault) in [#1332](https://github.com/VirtusLab/scala-cli/pull/1332)
166
+
* Scala CLI deb package - Priority and Section flag by [@lwronski](https://github.com/lwronski) in [#1338](https://github.com/VirtusLab/scala-cli/pull/1338)
167
+
168
+
#### Updates
169
+
170
+
* Update ammonite to 2.5.4-16-7317286d by [@scala-steward](https://github.com/scala-steward-org/scala-steward) in [#1283](https://github.com/VirtusLab/scala-cli/pull/1283)
171
+
* Update mill-main to 0.10.7 by [@scala-steward](https://github.com/scala-steward-org/scala-steward) in [#1284](https://github.com/VirtusLab/scala-cli/pull/1284)
172
+
* Update scalajs-env-nodejs_2.13 to 1.4.0 by [@scala-steward](https://github.com/scala-steward-org/scala-steward) in [#1303](https://github.com/VirtusLab/scala-cli/pull/1303)
173
+
* Update jsoniter-scala-core_2.13 to 2.16.0 by [@scala-steward](https://github.com/scala-steward-org/scala-steward) in [#1302](https://github.com/VirtusLab/scala-cli/pull/1302)
174
+
* Update core_2.13 to 3.7.6 by [@scala-steward](https://github.com/scala-steward-org/scala-steward) in [#1299](https://github.com/VirtusLab/scala-cli/pull/1299)
175
+
* Update ammonite to 2.5.4-19-cd76521f by [@scala-steward](https://github.com/scala-steward-org/scala-steward) in [#1298](https://github.com/VirtusLab/scala-cli/pull/1298)
176
+
* Update bsp4j to 2.1.0-M1 by [@lwronski](https://github.com/lwronski) in [#1277](https://github.com/VirtusLab/scala-cli/pull/1277)
177
+
* Bump VirtusLab/scala-cli-setup from 0.1.11 to 0.1.12 by [@dependabot](https://docs.github.com/en/code-security/dependabot) in [#1306](https://github.com/VirtusLab/scala-cli/pull/1306)
178
+
* Update jsoniter-scala-core_2.13 to 2.17.0 by [@scala-steward](https://github.com/scala-steward-org/scala-steward) in [#1311](https://github.com/VirtusLab/scala-cli/pull/1311)
179
+
* Update test-runner, tools to 0.4.7 by [@scala-steward](https://github.com/scala-steward-org/scala-steward) in [#1317](https://github.com/VirtusLab/scala-cli/pull/1317)
180
+
* Update jsoniter-scala-core_2.13 to 2.17.1 by [@scala-steward](https://github.com/scala-steward-org/scala-steward) in [#1320](https://github.com/VirtusLab/scala-cli/pull/1320)
181
+
* Update ammonite_3.1.3 to 2.5.4-22-4a9e6989 by [@scala-steward](https://github.com/scala-steward-org/scala-steward) in [#1329](https://github.com/VirtusLab/scala-cli/pull/1329)
182
+
* Update jsoniter-scala-core_2.13 to 2.17.2 by [@scala-steward](https://github.com/scala-steward-org/scala-steward) in [#1343](https://github.com/VirtusLab/scala-cli/pull/1343)
183
+
* Update python-native-libs to 0.2.4 by [@scala-steward](https://github.com/scala-steward-org/scala-steward) in [#1341](https://github.com/VirtusLab/scala-cli/pull/1341)
184
+
* Update org.eclipse.jgit to 6.3.0.202209071007-r by [@scala-steward](https://github.com/scala-steward-org/scala-steward) in [#1344](https://github.com/VirtusLab/scala-cli/pull/1344)
185
+
186
+
## New Contributors
187
+
*[@megri](https://github.com/megri) made their first contribution in [#1278](https://github.com/VirtusLab/scala-cli/pull/1278)
188
+
*[@keynmol](https://github.com/keynmol) made their first contribution in [#1282](https://github.com/VirtusLab/scala-cli/pull/1282)
0 commit comments