Skip to content

Commit

Permalink
Update docs about toolkit
Browse files Browse the repository at this point in the history
  • Loading branch information
MaciejG604 committed Dec 21, 2023
1 parent 6d50e41 commit 75bab60
Show file tree
Hide file tree
Showing 8 changed files with 36 additions and 30 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -210,8 +210,8 @@ final case class SharedOptions(
@Tag(tags.must)
compilationOutput: Option[String] = None,
@Group(HelpGroup.Scala.toString)
@HelpMessage("Add toolkit to classPath")
@ValueDescription("version|latest")
@HelpMessage(s"Add toolkit to classPath (not supported in Scala 2.12), 'default' version for Scala toolkit: ${Constants.toolkitDefaultVersion}, 'default' version for typelevel toolkit: ${Constants.typelevelToolkitDefaultVersion}")
@ValueDescription("version|default")
@Name("toolkit")
@Tag(tags.implementation)
@Tag(tags.inShortHelp)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,15 @@ import scala.cli.commands.SpecificationLevel

@DirectiveGroupName("Toolkit")
@DirectiveExamples("//> using toolkit 0.1.0")
@DirectiveExamples("//> using toolkit latest")
@DirectiveExamples("//> using test.toolkit latest")
@DirectiveExamples("//> using toolkit default")
@DirectiveExamples("//> using test.toolkit default")
@DirectiveUsage(
"//> using toolkit _version_",
"`//> using toolkit` _version_"
)
@DirectiveDescription("Use a toolkit as dependency")
@DirectiveDescription(
s"Use a toolkit as dependency (not supported in Scala 2.12), 'default' version for Scala toolkit: ${Constants.toolkitDefaultVersion}, 'default' version for typelevel toolkit: ${Constants.typelevelToolkitDefaultVersion}"
)
@DirectiveLevel(SpecificationLevel.SHOULD)
final case class Toolkit(
toolkit: Option[Positioned[String]] = None,
Expand Down
20 changes: 12 additions & 8 deletions website/docs/guides/introduction/toolkit.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ sidebar_position: 7

import {ChainedSnippets} from "../../../src/components/MarkdownComponents.js";

:::caution
Newer versions of toolkits dropped support for Scala 2.12
:::

# Scala Toolkit

[Scala Toolkit](https://github.com/scala/toolkit) is an ongoing
Expand All @@ -20,15 +24,15 @@ println(os.pwd)
```

```bash
scala-cli UseOsLib.sc --toolkit latest
scala-cli UseOsLib.sc --toolkit default
```

</ChainedSnippets>

Similarly, you can achieve the same with the `using toolkit` directive:

```scala compile
//> using toolkit latest
//> using toolkit default
@main def printPwd: Unit = println(os.pwd)
```

Expand All @@ -47,7 +51,7 @@ And so, you can use it like this:
<ChainedSnippets>

```scala title=Something.test.scala
//> using toolkit latest
//> using toolkit default
class Something extends munit.FunSuite {
test("foo") {
assert(true)
Expand All @@ -67,7 +71,7 @@ you can always use the `using test.toolkit` directive.
<ChainedSnippets>

```scala title=project.scala
//> using test.toolkit latest
//> using test.toolkit default
```

```scala title=Another.test.scala
Expand Down Expand Up @@ -110,16 +114,16 @@ object Hello extends IOApp.Simple {
```

```bash
scala-cli UseTypelevel.scala --toolkit org.typelevel:latest
scala-cli UseTypelevel.scala --toolkit typelevel:latest # typelevel has a shorter alias defined
scala-cli UseTypelevel.scala --toolkit org.typelevel:default
scala-cli UseTypelevel.scala --toolkit typelevel:default # typelevel has a shorter alias defined
```

</ChainedSnippets>

Similarly, you can achieve the same with the `using toolkit` directive:

```scala compile
//> using toolkit org.typelevel:latest
//> using toolkit org.typelevel:default

import cats.effect.*
import fs2.io.file.Files
Expand All @@ -134,7 +138,7 @@ object Hello extends IOApp.Simple {
Or with the alias:

```scala compile
//> using toolkit typelevel:latest
//> using toolkit typelevel:default

import cats.effect.*
import fs2.io.file.Files
Expand Down
2 changes: 1 addition & 1 deletion website/docs/reference/cli-options.md
Original file line number Diff line number Diff line change
Expand Up @@ -1543,7 +1543,7 @@ Copy compilation results to output directory using either relative or absolute p

Aliases: `--toolkit`

Add toolkit to classPath
Add toolkit to classPath (not supported in Scala 2.12), 'default' version for Scala toolkit: 0.2.1, 'default' version for typelevel toolkit: 0.1.20

### `--exclude`

Expand Down
6 changes: 3 additions & 3 deletions website/docs/reference/directives.md
Original file line number Diff line number Diff line change
Expand Up @@ -410,16 +410,16 @@ Set the test framework

### Toolkit

Use a toolkit as dependency
Use a toolkit as dependency (not supported in Scala 2.12), 'default' version for Scala toolkit: 0.2.1, 'default' version for typelevel toolkit: 0.1.20

`//> using toolkit` _version_

#### Examples
`//> using toolkit 0.1.0`

`//> using toolkit latest`
`//> using toolkit default`

`//> using test.toolkit latest`
`//> using test.toolkit default`


## target directives
Expand Down
2 changes: 1 addition & 1 deletion website/docs/reference/scala-command/cli-options.md
Original file line number Diff line number Diff line change
Expand Up @@ -1044,7 +1044,7 @@ Aliases: `--toolkit`

`IMPLEMENTATION specific` per Scala Runner specification

Add toolkit to classPath
Add toolkit to classPath (not supported in Scala 2.12), 'default' version for Scala toolkit: 0.2.1, 'default' version for typelevel toolkit: 0.1.20

### `--exclude`

Expand Down
6 changes: 3 additions & 3 deletions website/docs/reference/scala-command/directives.md
Original file line number Diff line number Diff line change
Expand Up @@ -296,14 +296,14 @@ Set the test framework

### Toolkit

Use a toolkit as dependency
Use a toolkit as dependency (not supported in Scala 2.12), 'default' version for Scala toolkit: 0.2.1, 'default' version for typelevel toolkit: 0.1.20

`//> using toolkit` _version_

#### Examples
`//> using toolkit 0.1.0`

`//> using toolkit latest`
`//> using toolkit default`

`//> using test.toolkit latest`
`//> using test.toolkit default`

18 changes: 9 additions & 9 deletions website/docs/reference/scala-command/runner-specification.md
Original file line number Diff line number Diff line change
Expand Up @@ -584,7 +584,7 @@ Aliases: `--help-fmt` ,`--scalafmt-help` ,`--fmt-help`

**--with-toolkit**

Add toolkit to classPath
Add toolkit to classPath (not supported in Scala 2.12), 'default' version for Scala toolkit: 0.2.1, 'default' version for typelevel toolkit: 0.1.20

Aliases: `--toolkit`

Expand Down Expand Up @@ -1311,7 +1311,7 @@ Aliases: `--help-fmt` ,`--scalafmt-help` ,`--fmt-help`

**--with-toolkit**

Add toolkit to classPath
Add toolkit to classPath (not supported in Scala 2.12), 'default' version for Scala toolkit: 0.2.1, 'default' version for typelevel toolkit: 0.1.20

Aliases: `--toolkit`

Expand Down Expand Up @@ -1864,7 +1864,7 @@ Aliases: `--help-fmt` ,`--scalafmt-help` ,`--fmt-help`

**--with-toolkit**

Add toolkit to classPath
Add toolkit to classPath (not supported in Scala 2.12), 'default' version for Scala toolkit: 0.2.1, 'default' version for typelevel toolkit: 0.1.20

Aliases: `--toolkit`

Expand Down Expand Up @@ -2447,7 +2447,7 @@ Aliases: `--help-fmt` ,`--scalafmt-help` ,`--fmt-help`

**--with-toolkit**

Add toolkit to classPath
Add toolkit to classPath (not supported in Scala 2.12), 'default' version for Scala toolkit: 0.2.1, 'default' version for typelevel toolkit: 0.1.20

Aliases: `--toolkit`

Expand Down Expand Up @@ -3039,7 +3039,7 @@ Aliases: `--help-fmt` ,`--scalafmt-help` ,`--fmt-help`

**--with-toolkit**

Add toolkit to classPath
Add toolkit to classPath (not supported in Scala 2.12), 'default' version for Scala toolkit: 0.2.1, 'default' version for typelevel toolkit: 0.1.20

Aliases: `--toolkit`

Expand Down Expand Up @@ -3589,7 +3589,7 @@ Aliases: `--help-fmt` ,`--scalafmt-help` ,`--fmt-help`

**--with-toolkit**

Add toolkit to classPath
Add toolkit to classPath (not supported in Scala 2.12), 'default' version for Scala toolkit: 0.2.1, 'default' version for typelevel toolkit: 0.1.20

Aliases: `--toolkit`

Expand Down Expand Up @@ -4214,7 +4214,7 @@ Aliases: `--help-fmt` ,`--scalafmt-help` ,`--fmt-help`

**--with-toolkit**

Add toolkit to classPath
Add toolkit to classPath (not supported in Scala 2.12), 'default' version for Scala toolkit: 0.2.1, 'default' version for typelevel toolkit: 0.1.20

Aliases: `--toolkit`

Expand Down Expand Up @@ -4846,7 +4846,7 @@ Aliases: `--help-fmt` ,`--scalafmt-help` ,`--fmt-help`

**--with-toolkit**

Add toolkit to classPath
Add toolkit to classPath (not supported in Scala 2.12), 'default' version for Scala toolkit: 0.2.1, 'default' version for typelevel toolkit: 0.1.20

Aliases: `--toolkit`

Expand Down Expand Up @@ -5733,7 +5733,7 @@ Aliases: `--help-fmt` ,`--scalafmt-help` ,`--fmt-help`

**--with-toolkit**

Add toolkit to classPath
Add toolkit to classPath (not supported in Scala 2.12), 'default' version for Scala toolkit: 0.2.1, 'default' version for typelevel toolkit: 0.1.20

Aliases: `--toolkit`

Expand Down

0 comments on commit 75bab60

Please sign in to comment.