From 580bece8c4b31b680b02cdadc9f87074d72309d4 Mon Sep 17 00:00:00 2001 From: Piotr Chabelski Date: Fri, 24 Feb 2023 10:37:21 +0100 Subject: [PATCH] Tweak reference doc generated messages - use `detailedMessage` instead of `message` for commands - convert console keys to markdown fence code blocks - filter out console keys from reference docs --- .../cli/commands/config/ConfigOptions.scala | 4 +- .../cli/commands/shebang/ShebangOptions.scala | 16 +- .../scala/cli/doc/GenerateReferenceDoc.scala | 5 +- .../scala/cli/doc/ReferenceDocUtils.scala | 34 ++- website/docs/reference/commands.md | 243 +++++++++++++----- .../docs/reference/scala-command/commands.md | 166 +++++++++--- .../scala-command/runner-specification.md | 166 +++++++++--- 7 files changed, 481 insertions(+), 153 deletions(-) diff --git a/modules/cli/src/main/scala/scala/cli/commands/config/ConfigOptions.scala b/modules/cli/src/main/scala/scala/cli/commands/config/ConfigOptions.scala index c660c31b09..fa65ad8952 100644 --- a/modules/cli/src/main/scala/scala/cli/commands/config/ConfigOptions.scala +++ b/modules/cli/src/main/scala/scala/cli/commands/config/ConfigOptions.scala @@ -96,9 +96,9 @@ object ConfigOptions { s"""$helpHeader | |Syntax: - | $progName $cmdName key value + | ${Console.BOLD}$progName $cmdName key value${Console.RESET} |For example, to globally set the interactive mode: - | $progName $cmdName interactive true + | ${Console.BOLD}$progName $cmdName interactive true${Console.RESET} | |${HelpMessages.commandDocWebsiteReference(websiteSuffix)}""".stripMargin } diff --git a/modules/cli/src/main/scala/scala/cli/commands/shebang/ShebangOptions.scala b/modules/cli/src/main/scala/scala/cli/commands/shebang/ShebangOptions.scala index 2e44041565..c8cd9be977 100644 --- a/modules/cli/src/main/scala/scala/cli/commands/shebang/ShebangOptions.scala +++ b/modules/cli/src/main/scala/scala/cli/commands/shebang/ShebangOptions.scala @@ -2,6 +2,7 @@ package scala.cli.commands.shebang import caseapp.* +import scala.build.internal.util.ConsoleUtils.ScalaCliConsole import scala.cli.ScalaCli.{baseRunnerName, fullRunnerName, progName} import scala.cli.commands.run.RunOptions import scala.cli.commands.shared.{HasSharedOptions, HelpMessages, SharedOptions} @@ -30,23 +31,16 @@ object ShebangOptions { | |When relying on the `run` sub-command, inputs and $baseRunnerName options can be mixed, |while program args have to be specified after `--` - | - |```sh - |$progName [command] [${baseRunnerName}_options | input]... -- [program_arguments]... - |``` + | ${Console.BOLD}$progName [command] [${baseRunnerName}_options | input]... -- [program_arguments]...${Console.RESET} | |However, for the `shebang` sub-command, only a single input file can be set, while all $baseRunnerName options |have to be set before the input file. |All inputs after the first are treated as program arguments, without the need for `--` - |```sh - |$progName shebang [${baseRunnerName}_options]... input [program_arguments]... - |``` + | ${Console.BOLD}$progName shebang [${baseRunnerName}_options]... input [program_arguments]...${Console.RESET} | |Using this, it is possible to conveniently set up Unix shebang scripts. For example: - |```sh - |#!/usr/bin/env -S $progName shebang --scala-version 2.13 - |println("Hello, world") - |``` + | ${ScalaCliConsole.GRAY}#!/usr/bin/env -S $progName shebang --scala-version 2.13 + | println("Hello, world")${Console.RESET} | |${HelpMessages.commandDocWebsiteReference(cmdName)}""".stripMargin } diff --git a/modules/generate-reference-doc/src/main/scala/scala/cli/doc/GenerateReferenceDoc.scala b/modules/generate-reference-doc/src/main/scala/scala/cli/doc/GenerateReferenceDoc.scala index cd30e5e0de..9aa4f2a85e 100644 --- a/modules/generate-reference-doc/src/main/scala/scala/cli/doc/GenerateReferenceDoc.scala +++ b/modules/generate-reference-doc/src/main/scala/scala/cli/doc/GenerateReferenceDoc.scala @@ -293,7 +293,8 @@ object GenerateReferenceDoc extends CaseApp[InternalDocOptions] { if (command.names.tail.nonEmpty) b.section(command.names.map(_.mkString(" ")).tail.mkString("Aliases: `", "`, `", "`")) - for (desc <- command.messages.helpMessage.map(_.referenceDocMessage)) b.section(desc) + for (desc <- command.messages.helpMessage.map(_.referenceDocDetailedMessage)) + b.section(desc) optionsForCommand(command) b.section("---") } @@ -333,7 +334,7 @@ object GenerateReferenceDoc extends CaseApp[InternalDocOptions] { b.append(s"$headerPrefix## ${names.head}\n\n") if (names.tail.nonEmpty) b.append(names.tail.sorted.mkString("Aliases: `", "`, `", "`\n\n")) - for (desc <- c.messages.helpMessage.map(_.referenceDocMessage)) b.section(desc) + for (desc <- c.messages.helpMessage.map(_.referenceDocDetailedMessage)) b.section(desc) if (origins.nonEmpty) { val links = origins.map { origin => diff --git a/modules/generate-reference-doc/src/main/scala/scala/cli/doc/ReferenceDocUtils.scala b/modules/generate-reference-doc/src/main/scala/scala/cli/doc/ReferenceDocUtils.scala index 8211feeaae..97405925b0 100644 --- a/modules/generate-reference-doc/src/main/scala/scala/cli/doc/ReferenceDocUtils.scala +++ b/modules/generate-reference-doc/src/main/scala/scala/cli/doc/ReferenceDocUtils.scala @@ -2,11 +2,41 @@ package scala.cli.doc import caseapp.HelpMessage -import scala.cli.commands.util.ConsoleUtils.* +import java.util.stream.IntStream + +import scala.build.internal.util.ConsoleUtils.* +import scala.jdk.StreamConverters.* object ReferenceDocUtils { + extension (s: String) { + def consoleToFence: String = + s + .lines() + .toScala(scala.List) + .fold("") { (acc, line) => + val maybeOpenFence = + if line.contains(Console.BOLD) then + """```sh + |""".stripMargin + else if line.contains(ScalaCliConsole.GRAY) then + """```scala + |""".stripMargin + else "" + val maybeCloseFence = + if line.contains(Console.RESET) then + """ + |```""".stripMargin + else "" + val newLine = s"$maybeOpenFence${line.noConsoleKeys}$maybeCloseFence" + if acc.isEmpty then newLine + else s"""$acc + |$newLine""".stripMargin + } + } extension (helpMessage: HelpMessage) { - def referenceDocMessage: String = helpMessage.message.noConsoleKeys + def referenceDocMessage: String = helpMessage.message.consoleToFence.noConsoleKeys + def referenceDocDetailedMessage: String = + helpMessage.detailedMessage.consoleToFence.noConsoleKeys } } diff --git a/website/docs/reference/commands.md b/website/docs/reference/commands.md index 423110f44c..170fd92906 100644 --- a/website/docs/reference/commands.md +++ b/website/docs/reference/commands.md @@ -10,8 +10,8 @@ sidebar_position: 3 Clean the workspace. -You are currently viewing the basic help for the clean sub-command. You can view the full help by running: - scala-cli clean --help-full +Passed inputs will establish the Scala CLI project, for which the workspace will be cleaned. + For detailed documentation refer to our website: https://scala-cli.virtuslab.org/docs/commands/clean Accepts option groups: [bsp file](./cli-options.md#bsp-file-options), [logging](./cli-options.md#logging-options), [verbosity](./cli-options.md#verbosity-options), [workspace](./cli-options.md#workspace-options) @@ -20,8 +20,16 @@ Accepts option groups: [bsp file](./cli-options.md#bsp-file-options), [logging]( Compile Scala code. -You are currently viewing the basic help for the compile sub-command. You can view the full help by running: - scala-cli compile --help-full +Specific compile configurations can be specified with both command line options and using directives defined in sources. +Command line options always take priority over using directives when a clash occurs, allowing to override configurations defined in sources. +Using directives can be defined in all supported input source file types. + +Multiple inputs can be passed at once. +Paths to directories, URLs and supported file types are accepted as inputs. +Accepted file extensions: .scala, .sc, .java, .jar, .md, .jar, .c, .h, .zip +For piped inputs use the corresponding alias: _.scala, _.java, _.sc, _.md +All supported types of inputs can be mixed with each other. + For detailed documentation refer to our website: https://scala-cli.virtuslab.org/docs/commands/compile Accepts option groups: [compilation server](./cli-options.md#compilation-server-options), [compile](./cli-options.md#compile-options), [coursier](./cli-options.md#coursier-options), [cross](./cli-options.md#cross-options), [debug](./cli-options.md#debug-options), [dependency](./cli-options.md#dependency-options), [help group](./cli-options.md#help-group-options), [input](./cli-options.md#input-options), [jvm](./cli-options.md#jvm-options), [logging](./cli-options.md#logging-options), [markdown](./cli-options.md#markdown-options), [python](./cli-options.md#python-options), [Scala.js](./cli-options.md#scalajs-options), [Scala Native](./cli-options.md#scala-native-options), [scalac](./cli-options.md#scalac-options), [scalac extra](./cli-options.md#scalac-extra-options), [shared](./cli-options.md#shared-options), [snippet](./cli-options.md#snippet-options), [suppress warning](./cli-options.md#suppress-warning-options), [verbosity](./cli-options.md#verbosity-options), [watch](./cli-options.md#watch-options), [workspace](./cli-options.md#workspace-options) @@ -30,15 +38,22 @@ Accepts option groups: [compilation server](./cli-options.md#compilation-server- Configure global settings for Scala CLI. -You are currently viewing the basic help for the config sub-command. You can view the full help by running: - scala-cli config --help-full +Syntax: +```sh + scala-cli config key value +``` +For example, to globally set the interactive mode: +```sh + scala-cli config interactive true +``` + For detailed documentation refer to our website: https://scala-cli.virtuslab.org/docs/commands/misc/config Accepts option groups: [config](./cli-options.md#config-options), [coursier](./cli-options.md#coursier-options), [debug](./cli-options.md#debug-options), [jvm](./cli-options.md#jvm-options), [logging](./cli-options.md#logging-options), [pgp scala signing](./cli-options.md#pgp-scala-signing-options), [verbosity](./cli-options.md#verbosity-options) ## dependency-update -Update dependency directives in the project + Accepts option groups: [compilation server](./cli-options.md#compilation-server-options), [coursier](./cli-options.md#coursier-options), [debug](./cli-options.md#debug-options), [dependency](./cli-options.md#dependency-options), [dependency update](./cli-options.md#dependency-update-options), [help group](./cli-options.md#help-group-options), [input](./cli-options.md#input-options), [jvm](./cli-options.md#jvm-options), [logging](./cli-options.md#logging-options), [markdown](./cli-options.md#markdown-options), [python](./cli-options.md#python-options), [Scala.js](./cli-options.md#scalajs-options), [Scala Native](./cli-options.md#scala-native-options), [scalac](./cli-options.md#scalac-options), [scalac extra](./cli-options.md#scalac-extra-options), [shared](./cli-options.md#shared-options), [snippet](./cli-options.md#snippet-options), [suppress warning](./cli-options.md#suppress-warning-options), [verbosity](./cli-options.md#verbosity-options), [workspace](./cli-options.md#workspace-options) @@ -46,8 +61,12 @@ Accepts option groups: [compilation server](./cli-options.md#compilation-server- Generate Scaladoc documentation. -You are currently viewing the basic help for the doc sub-command. You can view the full help by running: - scala-cli doc --help-full +Multiple inputs can be passed at once. +Paths to directories, URLs and supported file types are accepted as inputs. +Accepted file extensions: .scala, .sc, .java, .jar, .md, .jar, .c, .h, .zip +For piped inputs use the corresponding alias: _.scala, _.java, _.sc, _.md +All supported types of inputs can be mixed with each other. + For detailed documentation refer to our website: https://scala-cli.virtuslab.org/docs/commands/doc Accepts option groups: [compilation server](./cli-options.md#compilation-server-options), [coursier](./cli-options.md#coursier-options), [debug](./cli-options.md#debug-options), [dependency](./cli-options.md#dependency-options), [doc](./cli-options.md#doc-options), [help group](./cli-options.md#help-group-options), [input](./cli-options.md#input-options), [jvm](./cli-options.md#jvm-options), [logging](./cli-options.md#logging-options), [markdown](./cli-options.md#markdown-options), [python](./cli-options.md#python-options), [Scala.js](./cli-options.md#scalajs-options), [Scala Native](./cli-options.md#scala-native-options), [scalac](./cli-options.md#scalac-options), [scalac extra](./cli-options.md#scalac-extra-options), [shared](./cli-options.md#shared-options), [snippet](./cli-options.md#snippet-options), [suppress warning](./cli-options.md#suppress-warning-options), [verbosity](./cli-options.md#verbosity-options), [workspace](./cli-options.md#workspace-options) @@ -56,6 +75,16 @@ Accepts option groups: [compilation server](./cli-options.md#compilation-server- Export current project to an external build tool (like SBT or Mill). +The whole Scala CLI project should get exported along with its dependencies configuration. + +Unless otherwise configured, the default export format is SBT. + +Multiple inputs can be passed at once. +Paths to directories, URLs and supported file types are accepted as inputs. +Accepted file extensions: .scala, .sc, .java, .jar, .md, .jar, .c, .h, .zip +For piped inputs use the corresponding alias: _.scala, _.java, _.sc, _.md +All supported types of inputs can be mixed with each other. + Detailed documentation can be found on our website: https://scala-cli.virtuslab.org Accepts option groups: [compilation server](./cli-options.md#compilation-server-options), [coursier](./cli-options.md#coursier-options), [debug](./cli-options.md#debug-options), [dependency](./cli-options.md#dependency-options), [export](./cli-options.md#export-options), [help group](./cli-options.md#help-group-options), [input](./cli-options.md#input-options), [jvm](./cli-options.md#jvm-options), [logging](./cli-options.md#logging-options), [main class](./cli-options.md#main-class-options), [markdown](./cli-options.md#markdown-options), [python](./cli-options.md#python-options), [Scala.js](./cli-options.md#scalajs-options), [Scala Native](./cli-options.md#scala-native-options), [scalac](./cli-options.md#scalac-options), [scalac extra](./cli-options.md#scalac-extra-options), [shared](./cli-options.md#shared-options), [snippet](./cli-options.md#snippet-options), [suppress warning](./cli-options.md#suppress-warning-options), [verbosity](./cli-options.md#verbosity-options), [workspace](./cli-options.md#workspace-options) @@ -66,15 +95,20 @@ Aliases: `format`, `scalafmt` Formats Scala code. -You are currently viewing the basic help for the fmt sub-command. You can view the full help by running: - scala-cli fmt --help-full +`scalafmt` is used to perform the formatting under the hood. + +The `.scalafmt.conf` configuration file is optional. +Default configuration values will be assumed by Scala CLI. + +All standard Scala CLI inputs are accepted, but only Scala sources will be formatted (.scala and .sc files). + For detailed documentation refer to our website: https://scala-cli.virtuslab.org/docs/commands/fmt Accepts option groups: [compilation server](./cli-options.md#compilation-server-options), [coursier](./cli-options.md#coursier-options), [debug](./cli-options.md#debug-options), [dependency](./cli-options.md#dependency-options), [fmt](./cli-options.md#fmt-options), [help group](./cli-options.md#help-group-options), [input](./cli-options.md#input-options), [jvm](./cli-options.md#jvm-options), [logging](./cli-options.md#logging-options), [markdown](./cli-options.md#markdown-options), [python](./cli-options.md#python-options), [Scala.js](./cli-options.md#scalajs-options), [Scala Native](./cli-options.md#scala-native-options), [scalac](./cli-options.md#scalac-options), [scalac extra](./cli-options.md#scalac-extra-options), [shared](./cli-options.md#shared-options), [snippet](./cli-options.md#snippet-options), [suppress warning](./cli-options.md#suppress-warning-options), [verbosity](./cli-options.md#verbosity-options), [workspace](./cli-options.md#workspace-options) ## help -Print help message + Accepts option groups: [logging](./cli-options.md#logging-options), [verbosity](./cli-options.md#verbosity-options) @@ -84,8 +118,6 @@ Aliases: `install-completions` Installs Scala CLI completions into your shell -You are currently viewing the basic help for the install completions sub-command. You can view the full help by running: - scala-cli install completions --help-full For detailed documentation refer to our website: https://scala-cli.virtuslab.org/docs/commands/completions Accepts option groups: [install completions](./cli-options.md#install-completions-options), [logging](./cli-options.md#logging-options), [verbosity](./cli-options.md#verbosity-options) @@ -96,8 +128,18 @@ Aliases: `console` Fire-up a Scala REPL. -You are currently viewing the basic help for the repl sub-command. You can view the full help by running: - scala-cli repl --help-full +The entire Scala CLI project's classpath is loaded to the repl. + +Specific repl configurations can be specified with both command line options and using directives defined in sources. +Command line options always take priority over using directives when a clash occurs, allowing to override configurations defined in sources. +Using directives can be defined in all supported input source file types. + +Multiple inputs can be passed at once. +Paths to directories, URLs and supported file types are accepted as inputs. +Accepted file extensions: .scala, .sc, .java, .jar, .md, .jar, .c, .h, .zip +For piped inputs use the corresponding alias: _.scala, _.java, _.sc, _.md +All supported types of inputs can be mixed with each other. + For detailed documentation refer to our website: https://scala-cli.virtuslab.org/docs/commands/repl Accepts option groups: [compilation server](./cli-options.md#compilation-server-options), [coursier](./cli-options.md#coursier-options), [cross](./cli-options.md#cross-options), [debug](./cli-options.md#debug-options), [dependency](./cli-options.md#dependency-options), [help group](./cli-options.md#help-group-options), [input](./cli-options.md#input-options), [java](./cli-options.md#java-options), [java prop](./cli-options.md#java-prop-options), [jvm](./cli-options.md#jvm-options), [logging](./cli-options.md#logging-options), [markdown](./cli-options.md#markdown-options), [python](./cli-options.md#python-options), [repl](./cli-options.md#repl-options), [Scala.js](./cli-options.md#scalajs-options), [Scala Native](./cli-options.md#scala-native-options), [scalac](./cli-options.md#scalac-options), [scalac extra](./cli-options.md#scalac-extra-options), [shared](./cli-options.md#shared-options), [snippet](./cli-options.md#snippet-options), [suppress warning](./cli-options.md#suppress-warning-options), [verbosity](./cli-options.md#verbosity-options), [watch](./cli-options.md#watch-options), [workspace](./cli-options.md#workspace-options) @@ -106,8 +148,16 @@ Accepts option groups: [compilation server](./cli-options.md#compilation-server- Compile and package Scala code. -You are currently viewing the basic help for the package sub-command. You can view the full help by running: - scala-cli --power package --help-full +Specific package configurations can be specified with both command line options and using directives defined in sources. +Command line options always take priority over using directives when a clash occurs, allowing to override configurations defined in sources. +Using directives can be defined in all supported input source file types. + +Multiple inputs can be passed at once. +Paths to directories, URLs and supported file types are accepted as inputs. +Accepted file extensions: .scala, .sc, .java, .jar, .md, .jar, .c, .h, .zip +For piped inputs use the corresponding alias: _.scala, _.java, _.sc, _.md +All supported types of inputs can be mixed with each other. + For detailed documentation refer to our website: https://scala-cli.virtuslab.org/docs/commands/package Accepts option groups: [compilation server](./cli-options.md#compilation-server-options), [coursier](./cli-options.md#coursier-options), [cross](./cli-options.md#cross-options), [debug](./cli-options.md#debug-options), [dependency](./cli-options.md#dependency-options), [help group](./cli-options.md#help-group-options), [input](./cli-options.md#input-options), [java](./cli-options.md#java-options), [java prop](./cli-options.md#java-prop-options), [jvm](./cli-options.md#jvm-options), [logging](./cli-options.md#logging-options), [main class](./cli-options.md#main-class-options), [markdown](./cli-options.md#markdown-options), [package](./cli-options.md#package-options), [packager](./cli-options.md#packager-options), [python](./cli-options.md#python-options), [Scala.js](./cli-options.md#scalajs-options), [Scala Native](./cli-options.md#scala-native-options), [scalac](./cli-options.md#scalac-options), [scalac extra](./cli-options.md#scalac-extra-options), [shared](./cli-options.md#shared-options), [snippet](./cli-options.md#snippet-options), [suppress warning](./cli-options.md#suppress-warning-options), [verbosity](./cli-options.md#verbosity-options), [watch](./cli-options.md#watch-options), [workspace](./cli-options.md#workspace-options) @@ -116,8 +166,21 @@ Accepts option groups: [compilation server](./cli-options.md#compilation-server- Publishes build artifacts to Maven repositories. -You are currently viewing the basic help for the publish sub-command. You can view the full help by running: - scala-cli --power publish --help-full +We recommend running the `publish setup` sub-command once prior to +running `publish` in order to set missing `using` directives for publishing. +(but this is not mandatory) + scala-cli --power publish setup . + +Specific publish configurations can be specified with both command line options and using directives defined in sources. +Command line options always take priority over using directives when a clash occurs, allowing to override configurations defined in sources. +Using directives can be defined in all supported input source file types. + +Multiple inputs can be passed at once. +Paths to directories, URLs and supported file types are accepted as inputs. +Accepted file extensions: .scala, .sc, .java, .jar, .md, .jar, .c, .h, .zip +For piped inputs use the corresponding alias: _.scala, _.java, _.sc, _.md +All supported types of inputs can be mixed with each other. + For detailed documentation refer to our website: https://scala-cli.virtuslab.org/docs/commands/publishing/publish Accepts option groups: [compilation server](./cli-options.md#compilation-server-options), [coursier](./cli-options.md#coursier-options), [cross](./cli-options.md#cross-options), [debug](./cli-options.md#debug-options), [dependency](./cli-options.md#dependency-options), [help group](./cli-options.md#help-group-options), [input](./cli-options.md#input-options), [jvm](./cli-options.md#jvm-options), [logging](./cli-options.md#logging-options), [main class](./cli-options.md#main-class-options), [markdown](./cli-options.md#markdown-options), [pgp scala signing](./cli-options.md#pgp-scala-signing-options), [publish](./cli-options.md#publish-options), [publish params](./cli-options.md#publish-params-options), [publish repository](./cli-options.md#publish-repository-options), [python](./cli-options.md#python-options), [Scala.js](./cli-options.md#scalajs-options), [Scala Native](./cli-options.md#scala-native-options), [scalac](./cli-options.md#scalac-options), [scalac extra](./cli-options.md#scalac-extra-options), [shared](./cli-options.md#shared-options), [snippet](./cli-options.md#snippet-options), [suppress warning](./cli-options.md#suppress-warning-options), [verbosity](./cli-options.md#verbosity-options), [watch](./cli-options.md#watch-options), [workspace](./cli-options.md#workspace-options) @@ -126,8 +189,6 @@ Accepts option groups: [compilation server](./cli-options.md#compilation-server- Publishes build artifacts to the local Ivy2 repository. -You are currently viewing the basic help for the publish local sub-command. You can view the full help by running: - scala-cli publish local --help-full For detailed documentation refer to our website: https://scala-cli.virtuslab.org/docs/commands/publishing/publish-local Accepts option groups: [compilation server](./cli-options.md#compilation-server-options), [coursier](./cli-options.md#coursier-options), [cross](./cli-options.md#cross-options), [debug](./cli-options.md#debug-options), [dependency](./cli-options.md#dependency-options), [help group](./cli-options.md#help-group-options), [input](./cli-options.md#input-options), [jvm](./cli-options.md#jvm-options), [logging](./cli-options.md#logging-options), [main class](./cli-options.md#main-class-options), [markdown](./cli-options.md#markdown-options), [pgp scala signing](./cli-options.md#pgp-scala-signing-options), [publish](./cli-options.md#publish-options), [publish params](./cli-options.md#publish-params-options), [python](./cli-options.md#python-options), [Scala.js](./cli-options.md#scalajs-options), [Scala Native](./cli-options.md#scala-native-options), [scalac](./cli-options.md#scalac-options), [scalac extra](./cli-options.md#scalac-extra-options), [shared](./cli-options.md#shared-options), [snippet](./cli-options.md#snippet-options), [suppress warning](./cli-options.md#suppress-warning-options), [verbosity](./cli-options.md#verbosity-options), [watch](./cli-options.md#watch-options), [workspace](./cli-options.md#workspace-options) @@ -136,8 +197,6 @@ Accepts option groups: [compilation server](./cli-options.md#compilation-server- Configures the project for publishing. -You are currently viewing the basic help for the publish setup sub-command. You can view the full help by running: - scala-cli publish setup --help-full For detailed documentation refer to our website: https://scala-cli.virtuslab.org/docs/commands/publishing/publish-setup Accepts option groups: [coursier](./cli-options.md#coursier-options), [debug](./cli-options.md#debug-options), [input](./cli-options.md#input-options), [jvm](./cli-options.md#jvm-options), [logging](./cli-options.md#logging-options), [pgp push pull](./cli-options.md#pgp-push-pull-options), [pgp scala signing](./cli-options.md#pgp-scala-signing-options), [publish params](./cli-options.md#publish-params-options), [publish repository](./cli-options.md#publish-repository-options), [publish setup](./cli-options.md#publish-setup-options), [verbosity](./cli-options.md#verbosity-options), [workspace](./cli-options.md#workspace-options) @@ -146,8 +205,25 @@ Accepts option groups: [coursier](./cli-options.md#coursier-options), [debug](./ Compile and run Scala code. -You are currently viewing the basic help for the run sub-command. You can view the full help by running: - scala-cli run --help-full +Specific run configurations can be specified with both command line options and using directives defined in sources. +Command line options always take priority over using directives when a clash occurs, allowing to override configurations defined in sources. +Using directives can be defined in all supported input source file types. + +For a run to be successful, a main method must be present on the classpath. +.sc scripts are an exception, as a main class is provided in their wrapper. + +Multiple inputs can be passed at once. +Paths to directories, URLs and supported file types are accepted as inputs. +Accepted file extensions: .scala, .sc, .java, .jar, .md, .jar, .c, .h, .zip +For piped inputs use the corresponding alias: _.scala, _.java, _.sc, _.md +All supported types of inputs can be mixed with each other. + +To pass arguments to the actual application, just add them after `--`, like: + +```sh +scala-cli run Main.scala AnotherSource.scala -- first-arg second-arg +``` + For detailed documentation refer to our website: https://scala-cli.virtuslab.org/docs/commands/run Accepts option groups: [benchmarking](./cli-options.md#benchmarking-options), [compilation server](./cli-options.md#compilation-server-options), [coursier](./cli-options.md#coursier-options), [cross](./cli-options.md#cross-options), [debug](./cli-options.md#debug-options), [dependency](./cli-options.md#dependency-options), [help group](./cli-options.md#help-group-options), [input](./cli-options.md#input-options), [java](./cli-options.md#java-options), [java prop](./cli-options.md#java-prop-options), [jvm](./cli-options.md#jvm-options), [logging](./cli-options.md#logging-options), [main class](./cli-options.md#main-class-options), [markdown](./cli-options.md#markdown-options), [python](./cli-options.md#python-options), [run](./cli-options.md#run-options), [Scala.js](./cli-options.md#scalajs-options), [Scala Native](./cli-options.md#scala-native-options), [scalac](./cli-options.md#scalac-options), [scalac extra](./cli-options.md#scalac-extra-options), [shared](./cli-options.md#shared-options), [snippet](./cli-options.md#snippet-options), [suppress warning](./cli-options.md#suppress-warning-options), [verbosity](./cli-options.md#verbosity-options), [watch](./cli-options.md#watch-options), [workspace](./cli-options.md#workspace-options) @@ -156,8 +232,7 @@ Accepts option groups: [benchmarking](./cli-options.md#benchmarking-options), [c Aliases: `gh secret create` -Creates or updates a GitHub repository secret. - scala-cli --power github secret create --repo repo-org/repo-name SECRET_VALUE=value:secret + Accepts option groups: [coursier](./cli-options.md#coursier-options), [logging](./cli-options.md#logging-options), [secret](./cli-options.md#secret-options), [secret create](./cli-options.md#secret-create-options), [verbosity](./cli-options.md#verbosity-options) @@ -165,7 +240,7 @@ Accepts option groups: [coursier](./cli-options.md#coursier-options), [logging]( Aliases: `gh secret list` -Lists secrets for a given GitHub repository. + Accepts option groups: [logging](./cli-options.md#logging-options), [secret](./cli-options.md#secret-options), [verbosity](./cli-options.md#verbosity-options) @@ -173,8 +248,16 @@ Accepts option groups: [logging](./cli-options.md#logging-options), [secret](./c Generates a BSP file that you can import into your IDE. -You are currently viewing the basic help for the setup-ide sub-command. You can view the full help by running: - scala-cli setup-ide --help-full +The setup-ide sub-command allows to pre-configure a Scala CLI project to import to an IDE with BSP support. +It is also ran implicitly when `compile`, `run`, `shebang` or `test` sub-commands are called. + +The pre-configuration should be saved in a BSP json connection file under the path: + {project-root}/.bsp/scala-cli.json + +Specific setup-ide configurations can be specified with both command line options and using directives defined in sources. +Command line options always take priority over using directives when a clash occurs, allowing to override configurations defined in sources. +Using directives can be defined in all supported input source file types. + For detailed documentation refer to our website: https://scala-cli.virtuslab.org/docs/commands/setup-ide Accepts option groups: [bsp file](./cli-options.md#bsp-file-options), [compilation server](./cli-options.md#compilation-server-options), [coursier](./cli-options.md#coursier-options), [debug](./cli-options.md#debug-options), [dependency](./cli-options.md#dependency-options), [help group](./cli-options.md#help-group-options), [input](./cli-options.md#input-options), [jvm](./cli-options.md#jvm-options), [logging](./cli-options.md#logging-options), [markdown](./cli-options.md#markdown-options), [python](./cli-options.md#python-options), [Scala.js](./cli-options.md#scalajs-options), [Scala Native](./cli-options.md#scala-native-options), [scalac](./cli-options.md#scalac-options), [scalac extra](./cli-options.md#scalac-extra-options), [setup IDE](./cli-options.md#setup-ide-options), [shared](./cli-options.md#shared-options), [snippet](./cli-options.md#snippet-options), [suppress warning](./cli-options.md#suppress-warning-options), [verbosity](./cli-options.md#verbosity-options), [workspace](./cli-options.md#workspace-options) @@ -183,8 +266,29 @@ Accepts option groups: [bsp file](./cli-options.md#bsp-file-options), [compilati Like `run`, but handier for shebang scripts. -You are currently viewing the basic help for the shebang sub-command. You can view the full help by running: - scala-cli shebang --help-full +This command is equivalent to the `run` sub-command, but it changes the way +Scala CLI parses its command-line arguments in order to be compatible +with shebang scripts. + +When relying on the `run` sub-command, inputs and scala-cli options can be mixed, +while program args have to be specified after `--` +```sh + scala-cli [command] [scala-cli_options | input]... -- [program_arguments]... +``` + +However, for the `shebang` sub-command, only a single input file can be set, while all scala-cli options +have to be set before the input file. +All inputs after the first are treated as program arguments, without the need for `--` +```sh + scala-cli shebang [scala-cli_options]... input [program_arguments]... +``` + +Using this, it is possible to conveniently set up Unix shebang scripts. For example: +```scala + #!/usr/bin/env -S scala-cli shebang --scala-version 2.13 + println("Hello, world") +``` + For detailed documentation refer to our website: https://scala-cli.virtuslab.org/docs/commands/shebang Accepts option groups: [benchmarking](./cli-options.md#benchmarking-options), [compilation server](./cli-options.md#compilation-server-options), [coursier](./cli-options.md#coursier-options), [cross](./cli-options.md#cross-options), [debug](./cli-options.md#debug-options), [dependency](./cli-options.md#dependency-options), [help group](./cli-options.md#help-group-options), [input](./cli-options.md#input-options), [java](./cli-options.md#java-options), [java prop](./cli-options.md#java-prop-options), [jvm](./cli-options.md#jvm-options), [logging](./cli-options.md#logging-options), [main class](./cli-options.md#main-class-options), [markdown](./cli-options.md#markdown-options), [python](./cli-options.md#python-options), [run](./cli-options.md#run-options), [Scala.js](./cli-options.md#scalajs-options), [Scala Native](./cli-options.md#scala-native-options), [scalac](./cli-options.md#scalac-options), [scalac extra](./cli-options.md#scalac-extra-options), [shared](./cli-options.md#shared-options), [snippet](./cli-options.md#snippet-options), [suppress warning](./cli-options.md#suppress-warning-options), [verbosity](./cli-options.md#verbosity-options), [watch](./cli-options.md#watch-options), [workspace](./cli-options.md#workspace-options) @@ -193,17 +297,29 @@ Accepts option groups: [benchmarking](./cli-options.md#benchmarking-options), [c Compile and test Scala code. -You are currently viewing the basic help for the test sub-command. You can view the full help by running: - scala-cli test --help-full +Test sources are compiled separately (after the 'main' sources), and may use different dependencies, compiler options, and other configurations. +A source file is treated as a test source if: + - it contains the `//> using target.scope "test"` directive + - the file name ends with `.test.scala` + - the file comes from a directory that is provided as input, and the relative path from that file to its original directory contains a `test` directory + +Specific test configurations can be specified with both command line options and using directives defined in sources. +Command line options always take priority over using directives when a clash occurs, allowing to override configurations defined in sources. +Using directives can be defined in all supported input source file types. + +Multiple inputs can be passed at once. +Paths to directories, URLs and supported file types are accepted as inputs. +Accepted file extensions: .scala, .sc, .java, .jar, .md, .jar, .c, .h, .zip +For piped inputs use the corresponding alias: _.scala, _.java, _.sc, _.md +All supported types of inputs can be mixed with each other. + For detailed documentation refer to our website: https://scala-cli.virtuslab.org/docs/commands/test Accepts option groups: [compilation server](./cli-options.md#compilation-server-options), [coursier](./cli-options.md#coursier-options), [cross](./cli-options.md#cross-options), [debug](./cli-options.md#debug-options), [dependency](./cli-options.md#dependency-options), [help group](./cli-options.md#help-group-options), [input](./cli-options.md#input-options), [java](./cli-options.md#java-options), [java prop](./cli-options.md#java-prop-options), [jvm](./cli-options.md#jvm-options), [logging](./cli-options.md#logging-options), [markdown](./cli-options.md#markdown-options), [python](./cli-options.md#python-options), [Scala.js](./cli-options.md#scalajs-options), [Scala Native](./cli-options.md#scala-native-options), [scalac](./cli-options.md#scalac-options), [scalac extra](./cli-options.md#scalac-extra-options), [shared](./cli-options.md#shared-options), [snippet](./cli-options.md#snippet-options), [suppress warning](./cli-options.md#suppress-warning-options), [test](./cli-options.md#test-options), [verbosity](./cli-options.md#verbosity-options), [watch](./cli-options.md#watch-options), [workspace](./cli-options.md#workspace-options) ## uninstall -Uninstalls Scala CLI. -Works only when installed with the installation script. -For detailed installation instructions refer to our website: https://scala-cli.virtuslab.org/install + Accepts option groups: [compilation server](./cli-options.md#compilation-server-options), [coursier](./cli-options.md#coursier-options), [logging](./cli-options.md#logging-options), [uninstall](./cli-options.md#uninstall-options), [uninstall completions](./cli-options.md#uninstall-completions-options), [verbosity](./cli-options.md#verbosity-options) @@ -213,8 +329,6 @@ Aliases: `uninstall-completions` Uninstalls Scala CLI completions from your shell. -You are currently viewing the basic help for the uninstall completions sub-command. You can view the full help by running: - scala-cli uninstall completions --help-full For detailed documentation refer to our website: https://scala-cli.virtuslab.org/docs/commands/completions Accepts option groups: [logging](./cli-options.md#logging-options), [uninstall completions](./cli-options.md#uninstall-completions-options), [verbosity](./cli-options.md#verbosity-options) @@ -225,18 +339,20 @@ Updates Scala CLI. Works only when installed with the installation script. If Scala CLI was installed with an external tool, refer to its update methods. -You are currently viewing the basic help for the update sub-command. You can view the full help by running: - scala-cli update --help-full For detailed installation instructions refer to our website: https://scala-cli.virtuslab.org/install Accepts option groups: [logging](./cli-options.md#logging-options), [update](./cli-options.md#update-options), [verbosity](./cli-options.md#verbosity-options) ## version -Prints the version of the Scala CLI and the default version of Scala. +Prints the version of the Scala CLI and the default version of Scala. (which can be overridden in the project) +If network connection is available, this sub-command also checks if the installed Scala CLI is up-to-date. + +The version of the Scala CLI is the version of the command-line tool that runs Scala programs, which +is distinct from the Scala version of the compiler. We recommend to specify the version of the Scala compiler +for a project in its sources (via a using directive). Otherwise, Scala CLI falls back to the default +Scala version defined by the runner. -You are currently viewing the basic help for the version sub-command. You can view the full help by running: - scala-cli version --help-full For detailed documentation refer to our website: https://scala-cli.virtuslab.org/docs/commands/version Accepts option groups: [logging](./cli-options.md#logging-options), [verbosity](./cli-options.md#verbosity-options), [version](./cli-options.md#version-options) @@ -245,7 +361,7 @@ Accepts option groups: [logging](./cli-options.md#logging-options), [verbosity]( ### add-path -Add entries to the PATH environment variable. + Accepts option groups: [add path](./cli-options.md#add-path-options), [logging](./cli-options.md#logging-options), [verbosity](./cli-options.md#verbosity-options) @@ -253,32 +369,29 @@ Accepts option groups: [add path](./cli-options.md#add-path-options), [logging]( Interact with Bloop (the build server) or check its status. +This sub-command allows to check the current status of Bloop. +If Bloop isn't currently running, it will be started. + +Bloop is the build server used by Scala CLI. +For more information about Bloop, refer to https://scalacenter.github.io/bloop/ + Accepts option groups: [bloop](./cli-options.md#bloop-options), [compilation server](./cli-options.md#compilation-server-options), [coursier](./cli-options.md#coursier-options), [debug](./cli-options.md#debug-options), [jvm](./cli-options.md#jvm-options), [logging](./cli-options.md#logging-options), [verbosity](./cli-options.md#verbosity-options) ### bloop exit -Stop Bloop if an instance is running. -Bloop is the build server used by Scala CLI. -For more information about Bloop, refer to https://scalacenter.github.io/bloop/ Accepts option groups: [compilation server](./cli-options.md#compilation-server-options), [coursier](./cli-options.md#coursier-options), [logging](./cli-options.md#logging-options), [verbosity](./cli-options.md#verbosity-options) ### bloop output -Print Bloop output. -Bloop is the build server used by Scala CLI. -For more information about Bloop, refer to https://scalacenter.github.io/bloop/ Accepts option groups: [compilation server](./cli-options.md#compilation-server-options), [logging](./cli-options.md#logging-options), [verbosity](./cli-options.md#verbosity-options) ### bloop start -Starts a Bloop instance, if none is running. -Bloop is the build server used by Scala CLI. -For more information about Bloop, refer to https://scalacenter.github.io/bloop/ Accepts option groups: [bloop start](./cli-options.md#bloop-start-options), [compilation server](./cli-options.md#compilation-server-options), [coursier](./cli-options.md#coursier-options), [debug](./cli-options.md#debug-options), [jvm](./cli-options.md#jvm-options), [logging](./cli-options.md#logging-options), [verbosity](./cli-options.md#verbosity-options) @@ -286,29 +399,31 @@ Accepts option groups: [bloop start](./cli-options.md#bloop-start-options), [com Start BSP server. -You are currently viewing the basic help for the bsp sub-command. You can view the full help by running: - scala-cli bsp --help-full +BSP stands for Build Server Protocol. +For more information refer to https://build-server-protocol.github.io/ + +This sub-command is not designed to be used by a human. +It is normally supposed to be invoked by your IDE when a Scala CLI project is imported. + Detailed documentation can be found on our website: https://scala-cli.virtuslab.org Accepts option groups: [bsp](./cli-options.md#bsp-options), [compilation server](./cli-options.md#compilation-server-options), [coursier](./cli-options.md#coursier-options), [debug](./cli-options.md#debug-options), [dependency](./cli-options.md#dependency-options), [help group](./cli-options.md#help-group-options), [input](./cli-options.md#input-options), [jvm](./cli-options.md#jvm-options), [logging](./cli-options.md#logging-options), [markdown](./cli-options.md#markdown-options), [python](./cli-options.md#python-options), [Scala.js](./cli-options.md#scalajs-options), [Scala Native](./cli-options.md#scala-native-options), [scalac](./cli-options.md#scalac-options), [scalac extra](./cli-options.md#scalac-extra-options), [shared](./cli-options.md#shared-options), [snippet](./cli-options.md#snippet-options), [suppress warning](./cli-options.md#suppress-warning-options), [verbosity](./cli-options.md#verbosity-options), [workspace](./cli-options.md#workspace-options) ### default-file -Generates default files for a Scala CLI project (i.e. .gitignore). -For detailed documentation refer to our website: https://scala-cli.virtuslab.org/docs/commands/misc/default-file Accepts option groups: [default file](./cli-options.md#default-file-options), [logging](./cli-options.md#logging-options), [verbosity](./cli-options.md#verbosity-options) ### directories -Prints directories used by Scala CLI. + Accepts option groups: [logging](./cli-options.md#logging-options), [verbosity](./cli-options.md#verbosity-options) ### install-home -Install Scala CLI in a sub-directory of the home directory + Accepts option groups: [install home](./cli-options.md#install-home-options), [logging](./cli-options.md#logging-options), [verbosity](./cli-options.md#verbosity-options) @@ -322,7 +437,7 @@ Accepts option groups: [coursier](./cli-options.md#coursier-options), [debug](./ ### pgp create -Create PGP key pair + Accepts option groups: [pgp create](./cli-options.md#pgp-create-options) @@ -332,13 +447,13 @@ Accepts option groups: [pgp key id](./cli-options.md#pgp-key-id-options) ### pgp sign -Sign files with PGP + Accepts option groups: [pgp sign](./cli-options.md#pgp-sign-options) ### pgp verify -Verify PGP signatures + Accepts option groups: [pgp verify](./cli-options.md#pgp-verify-options) diff --git a/website/docs/reference/scala-command/commands.md b/website/docs/reference/scala-command/commands.md index 29c918f086..938bdf2521 100644 --- a/website/docs/reference/scala-command/commands.md +++ b/website/docs/reference/scala-command/commands.md @@ -19,8 +19,16 @@ that is reserved for commands that need to be present for Scala CLI to work prop Compile Scala code. -You are currently viewing the basic help for the compile sub-command. You can view the full help by running: - scala-cli compile --help-full +Specific compile configurations can be specified with both command line options and using directives defined in sources. +Command line options always take priority over using directives when a clash occurs, allowing to override configurations defined in sources. +Using directives can be defined in all supported input source file types. + +Multiple inputs can be passed at once. +Paths to directories, URLs and supported file types are accepted as inputs. +Accepted file extensions: .scala, .sc, .java, .jar, .md, .jar, .c, .h, .zip +For piped inputs use the corresponding alias: _.scala, _.java, _.sc, _.md +All supported types of inputs can be mixed with each other. + For detailed documentation refer to our website: https://scala-cli.virtuslab.org/docs/commands/compile Accepts option groups: [compilation server](./cli-options.md#compilation-server-options), [compile](./cli-options.md#compile-options), [coursier](./cli-options.md#coursier-options), [cross](./cli-options.md#cross-options), [debug](./cli-options.md#debug-options), [dependency](./cli-options.md#dependency-options), [help group](./cli-options.md#help-group-options), [input](./cli-options.md#input-options), [jvm](./cli-options.md#jvm-options), [logging](./cli-options.md#logging-options), [markdown](./cli-options.md#markdown-options), [python](./cli-options.md#python-options), [Scala.js](./cli-options.md#scalajs-options), [Scala Native](./cli-options.md#scala-native-options), [scalac](./cli-options.md#scalac-options), [scalac extra](./cli-options.md#scalac-extra-options), [shared](./cli-options.md#shared-options), [snippet](./cli-options.md#snippet-options), [suppress warning](./cli-options.md#suppress-warning-options), [verbosity](./cli-options.md#verbosity-options), [watch](./cli-options.md#watch-options), [workspace](./cli-options.md#workspace-options) @@ -29,8 +37,15 @@ Accepts option groups: [compilation server](./cli-options.md#compilation-server- Configure global settings for Scala CLI. -You are currently viewing the basic help for the config sub-command. You can view the full help by running: - scala-cli config --help-full +Syntax: +```sh + scala-cli config key value +``` +For example, to globally set the interactive mode: +```sh + scala-cli config interactive true +``` + For detailed documentation refer to our website: https://scala-cli.virtuslab.org/docs/commands/misc/config Accepts option groups: [config](./cli-options.md#config-options), [coursier](./cli-options.md#coursier-options), [debug](./cli-options.md#debug-options), [jvm](./cli-options.md#jvm-options), [logging](./cli-options.md#logging-options), [pgp scala signing](./cli-options.md#pgp-scala-signing-options), [verbosity](./cli-options.md#verbosity-options) @@ -39,8 +54,12 @@ Accepts option groups: [config](./cli-options.md#config-options), [coursier](./c Generate Scaladoc documentation. -You are currently viewing the basic help for the doc sub-command. You can view the full help by running: - scala-cli doc --help-full +Multiple inputs can be passed at once. +Paths to directories, URLs and supported file types are accepted as inputs. +Accepted file extensions: .scala, .sc, .java, .jar, .md, .jar, .c, .h, .zip +For piped inputs use the corresponding alias: _.scala, _.java, _.sc, _.md +All supported types of inputs can be mixed with each other. + For detailed documentation refer to our website: https://scala-cli.virtuslab.org/docs/commands/doc Accepts option groups: [compilation server](./cli-options.md#compilation-server-options), [coursier](./cli-options.md#coursier-options), [debug](./cli-options.md#debug-options), [dependency](./cli-options.md#dependency-options), [doc](./cli-options.md#doc-options), [help group](./cli-options.md#help-group-options), [input](./cli-options.md#input-options), [jvm](./cli-options.md#jvm-options), [logging](./cli-options.md#logging-options), [markdown](./cli-options.md#markdown-options), [python](./cli-options.md#python-options), [Scala.js](./cli-options.md#scalajs-options), [Scala Native](./cli-options.md#scala-native-options), [scalac](./cli-options.md#scalac-options), [scalac extra](./cli-options.md#scalac-extra-options), [shared](./cli-options.md#shared-options), [snippet](./cli-options.md#snippet-options), [suppress warning](./cli-options.md#suppress-warning-options), [verbosity](./cli-options.md#verbosity-options), [workspace](./cli-options.md#workspace-options) @@ -51,8 +70,18 @@ Aliases: `console` Fire-up a Scala REPL. -You are currently viewing the basic help for the repl sub-command. You can view the full help by running: - scala-cli repl --help-full +The entire Scala CLI project's classpath is loaded to the repl. + +Specific repl configurations can be specified with both command line options and using directives defined in sources. +Command line options always take priority over using directives when a clash occurs, allowing to override configurations defined in sources. +Using directives can be defined in all supported input source file types. + +Multiple inputs can be passed at once. +Paths to directories, URLs and supported file types are accepted as inputs. +Accepted file extensions: .scala, .sc, .java, .jar, .md, .jar, .c, .h, .zip +For piped inputs use the corresponding alias: _.scala, _.java, _.sc, _.md +All supported types of inputs can be mixed with each other. + For detailed documentation refer to our website: https://scala-cli.virtuslab.org/docs/commands/repl Accepts option groups: [compilation server](./cli-options.md#compilation-server-options), [coursier](./cli-options.md#coursier-options), [cross](./cli-options.md#cross-options), [debug](./cli-options.md#debug-options), [dependency](./cli-options.md#dependency-options), [help group](./cli-options.md#help-group-options), [input](./cli-options.md#input-options), [java](./cli-options.md#java-options), [java prop](./cli-options.md#java-prop-options), [jvm](./cli-options.md#jvm-options), [logging](./cli-options.md#logging-options), [markdown](./cli-options.md#markdown-options), [python](./cli-options.md#python-options), [repl](./cli-options.md#repl-options), [Scala.js](./cli-options.md#scalajs-options), [Scala Native](./cli-options.md#scala-native-options), [scalac](./cli-options.md#scalac-options), [scalac extra](./cli-options.md#scalac-extra-options), [shared](./cli-options.md#shared-options), [snippet](./cli-options.md#snippet-options), [suppress warning](./cli-options.md#suppress-warning-options), [verbosity](./cli-options.md#verbosity-options), [watch](./cli-options.md#watch-options), [workspace](./cli-options.md#workspace-options) @@ -61,8 +90,25 @@ Accepts option groups: [compilation server](./cli-options.md#compilation-server- Compile and run Scala code. -You are currently viewing the basic help for the run sub-command. You can view the full help by running: - scala-cli run --help-full +Specific run configurations can be specified with both command line options and using directives defined in sources. +Command line options always take priority over using directives when a clash occurs, allowing to override configurations defined in sources. +Using directives can be defined in all supported input source file types. + +For a run to be successful, a main method must be present on the classpath. +.sc scripts are an exception, as a main class is provided in their wrapper. + +Multiple inputs can be passed at once. +Paths to directories, URLs and supported file types are accepted as inputs. +Accepted file extensions: .scala, .sc, .java, .jar, .md, .jar, .c, .h, .zip +For piped inputs use the corresponding alias: _.scala, _.java, _.sc, _.md +All supported types of inputs can be mixed with each other. + +To pass arguments to the actual application, just add them after `--`, like: + +```sh +scala-cli run Main.scala AnotherSource.scala -- first-arg second-arg +``` + For detailed documentation refer to our website: https://scala-cli.virtuslab.org/docs/commands/run Accepts option groups: [benchmarking](./cli-options.md#benchmarking-options), [compilation server](./cli-options.md#compilation-server-options), [coursier](./cli-options.md#coursier-options), [cross](./cli-options.md#cross-options), [debug](./cli-options.md#debug-options), [dependency](./cli-options.md#dependency-options), [help group](./cli-options.md#help-group-options), [input](./cli-options.md#input-options), [java](./cli-options.md#java-options), [java prop](./cli-options.md#java-prop-options), [jvm](./cli-options.md#jvm-options), [logging](./cli-options.md#logging-options), [main class](./cli-options.md#main-class-options), [markdown](./cli-options.md#markdown-options), [python](./cli-options.md#python-options), [run](./cli-options.md#run-options), [Scala.js](./cli-options.md#scalajs-options), [Scala Native](./cli-options.md#scala-native-options), [scalac](./cli-options.md#scalac-options), [scalac extra](./cli-options.md#scalac-extra-options), [shared](./cli-options.md#shared-options), [snippet](./cli-options.md#snippet-options), [suppress warning](./cli-options.md#suppress-warning-options), [verbosity](./cli-options.md#verbosity-options), [watch](./cli-options.md#watch-options), [workspace](./cli-options.md#workspace-options) @@ -71,8 +117,29 @@ Accepts option groups: [benchmarking](./cli-options.md#benchmarking-options), [c Like `run`, but handier for shebang scripts. -You are currently viewing the basic help for the shebang sub-command. You can view the full help by running: - scala-cli shebang --help-full +This command is equivalent to the `run` sub-command, but it changes the way +Scala CLI parses its command-line arguments in order to be compatible +with shebang scripts. + +When relying on the `run` sub-command, inputs and scala-cli options can be mixed, +while program args have to be specified after `--` +```sh + scala-cli [command] [scala-cli_options | input]... -- [program_arguments]... +``` + +However, for the `shebang` sub-command, only a single input file can be set, while all scala-cli options +have to be set before the input file. +All inputs after the first are treated as program arguments, without the need for `--` +```sh + scala-cli shebang [scala-cli_options]... input [program_arguments]... +``` + +Using this, it is possible to conveniently set up Unix shebang scripts. For example: +```scala + #!/usr/bin/env -S scala-cli shebang --scala-version 2.13 + println("Hello, world") +``` + For detailed documentation refer to our website: https://scala-cli.virtuslab.org/docs/commands/shebang Accepts option groups: [benchmarking](./cli-options.md#benchmarking-options), [compilation server](./cli-options.md#compilation-server-options), [coursier](./cli-options.md#coursier-options), [cross](./cli-options.md#cross-options), [debug](./cli-options.md#debug-options), [dependency](./cli-options.md#dependency-options), [help group](./cli-options.md#help-group-options), [input](./cli-options.md#input-options), [java](./cli-options.md#java-options), [java prop](./cli-options.md#java-prop-options), [jvm](./cli-options.md#jvm-options), [logging](./cli-options.md#logging-options), [main class](./cli-options.md#main-class-options), [markdown](./cli-options.md#markdown-options), [python](./cli-options.md#python-options), [run](./cli-options.md#run-options), [Scala.js](./cli-options.md#scalajs-options), [Scala Native](./cli-options.md#scala-native-options), [scalac](./cli-options.md#scalac-options), [scalac extra](./cli-options.md#scalac-extra-options), [shared](./cli-options.md#shared-options), [snippet](./cli-options.md#snippet-options), [suppress warning](./cli-options.md#suppress-warning-options), [verbosity](./cli-options.md#verbosity-options), [watch](./cli-options.md#watch-options), [workspace](./cli-options.md#workspace-options) @@ -85,8 +152,13 @@ Aliases: `format`, `scalafmt` Formats Scala code. -You are currently viewing the basic help for the fmt sub-command. You can view the full help by running: - scala-cli fmt --help-full +`scalafmt` is used to perform the formatting under the hood. + +The `.scalafmt.conf` configuration file is optional. +Default configuration values will be assumed by Scala CLI. + +All standard Scala CLI inputs are accepted, but only Scala sources will be formatted (.scala and .sc files). + For detailed documentation refer to our website: https://scala-cli.virtuslab.org/docs/commands/fmt Accepts option groups: [compilation server](./cli-options.md#compilation-server-options), [coursier](./cli-options.md#coursier-options), [debug](./cli-options.md#debug-options), [dependency](./cli-options.md#dependency-options), [fmt](./cli-options.md#fmt-options), [help group](./cli-options.md#help-group-options), [input](./cli-options.md#input-options), [jvm](./cli-options.md#jvm-options), [logging](./cli-options.md#logging-options), [markdown](./cli-options.md#markdown-options), [python](./cli-options.md#python-options), [Scala.js](./cli-options.md#scalajs-options), [Scala Native](./cli-options.md#scala-native-options), [scalac](./cli-options.md#scalac-options), [scalac extra](./cli-options.md#scalac-extra-options), [shared](./cli-options.md#shared-options), [snippet](./cli-options.md#snippet-options), [suppress warning](./cli-options.md#suppress-warning-options), [verbosity](./cli-options.md#verbosity-options), [workspace](./cli-options.md#workspace-options) @@ -95,18 +167,36 @@ Accepts option groups: [compilation server](./cli-options.md#compilation-server- Compile and test Scala code. -You are currently viewing the basic help for the test sub-command. You can view the full help by running: - scala-cli test --help-full +Test sources are compiled separately (after the 'main' sources), and may use different dependencies, compiler options, and other configurations. +A source file is treated as a test source if: + - it contains the `//> using target.scope "test"` directive + - the file name ends with `.test.scala` + - the file comes from a directory that is provided as input, and the relative path from that file to its original directory contains a `test` directory + +Specific test configurations can be specified with both command line options and using directives defined in sources. +Command line options always take priority over using directives when a clash occurs, allowing to override configurations defined in sources. +Using directives can be defined in all supported input source file types. + +Multiple inputs can be passed at once. +Paths to directories, URLs and supported file types are accepted as inputs. +Accepted file extensions: .scala, .sc, .java, .jar, .md, .jar, .c, .h, .zip +For piped inputs use the corresponding alias: _.scala, _.java, _.sc, _.md +All supported types of inputs can be mixed with each other. + For detailed documentation refer to our website: https://scala-cli.virtuslab.org/docs/commands/test Accepts option groups: [compilation server](./cli-options.md#compilation-server-options), [coursier](./cli-options.md#coursier-options), [cross](./cli-options.md#cross-options), [debug](./cli-options.md#debug-options), [dependency](./cli-options.md#dependency-options), [help group](./cli-options.md#help-group-options), [input](./cli-options.md#input-options), [java](./cli-options.md#java-options), [java prop](./cli-options.md#java-prop-options), [jvm](./cli-options.md#jvm-options), [logging](./cli-options.md#logging-options), [markdown](./cli-options.md#markdown-options), [python](./cli-options.md#python-options), [Scala.js](./cli-options.md#scalajs-options), [Scala Native](./cli-options.md#scala-native-options), [scalac](./cli-options.md#scalac-options), [scalac extra](./cli-options.md#scalac-extra-options), [shared](./cli-options.md#shared-options), [snippet](./cli-options.md#snippet-options), [suppress warning](./cli-options.md#suppress-warning-options), [test](./cli-options.md#test-options), [verbosity](./cli-options.md#verbosity-options), [watch](./cli-options.md#watch-options), [workspace](./cli-options.md#workspace-options) ### version -Prints the version of the Scala CLI and the default version of Scala. +Prints the version of the Scala CLI and the default version of Scala. (which can be overridden in the project) +If network connection is available, this sub-command also checks if the installed Scala CLI is up-to-date. + +The version of the Scala CLI is the version of the command-line tool that runs Scala programs, which +is distinct from the Scala version of the compiler. We recommend to specify the version of the Scala compiler +for a project in its sources (via a using directive). Otherwise, Scala CLI falls back to the default +Scala version defined by the runner. -You are currently viewing the basic help for the version sub-command. You can view the full help by running: - scala-cli version --help-full For detailed documentation refer to our website: https://scala-cli.virtuslab.org/docs/commands/version Accepts option groups: [logging](./cli-options.md#logging-options), [verbosity](./cli-options.md#verbosity-options), [version](./cli-options.md#version-options) @@ -119,8 +209,12 @@ Commands which are used within Scala CLI and should be a part of the `scala` com Start BSP server. -You are currently viewing the basic help for the bsp sub-command. You can view the full help by running: - scala-cli bsp --help-full +BSP stands for Build Server Protocol. +For more information refer to https://build-server-protocol.github.io/ + +This sub-command is not designed to be used by a human. +It is normally supposed to be invoked by your IDE when a Scala CLI project is imported. + Detailed documentation can be found on our website: https://scala-cli.virtuslab.org Accepts option groups: [bsp](./cli-options.md#bsp-options), [compilation server](./cli-options.md#compilation-server-options), [coursier](./cli-options.md#coursier-options), [debug](./cli-options.md#debug-options), [dependency](./cli-options.md#dependency-options), [help group](./cli-options.md#help-group-options), [input](./cli-options.md#input-options), [jvm](./cli-options.md#jvm-options), [logging](./cli-options.md#logging-options), [markdown](./cli-options.md#markdown-options), [python](./cli-options.md#python-options), [Scala.js](./cli-options.md#scalajs-options), [Scala Native](./cli-options.md#scala-native-options), [scalac](./cli-options.md#scalac-options), [scalac extra](./cli-options.md#scalac-extra-options), [shared](./cli-options.md#shared-options), [snippet](./cli-options.md#snippet-options), [suppress warning](./cli-options.md#suppress-warning-options), [verbosity](./cli-options.md#verbosity-options), [workspace](./cli-options.md#workspace-options) @@ -129,15 +223,15 @@ Accepts option groups: [bsp](./cli-options.md#bsp-options), [compilation server] Clean the workspace. -You are currently viewing the basic help for the clean sub-command. You can view the full help by running: - scala-cli clean --help-full +Passed inputs will establish the Scala CLI project, for which the workspace will be cleaned. + For detailed documentation refer to our website: https://scala-cli.virtuslab.org/docs/commands/clean Accepts option groups: [bsp file](./cli-options.md#bsp-file-options), [logging](./cli-options.md#logging-options), [verbosity](./cli-options.md#verbosity-options), [workspace](./cli-options.md#workspace-options) ### help -Print help message + Accepts option groups: [logging](./cli-options.md#logging-options), [verbosity](./cli-options.md#verbosity-options) @@ -147,15 +241,13 @@ Aliases: `install-completions` Installs Scala CLI completions into your shell -You are currently viewing the basic help for the install completions sub-command. You can view the full help by running: - scala-cli install completions --help-full For detailed documentation refer to our website: https://scala-cli.virtuslab.org/docs/commands/completions Accepts option groups: [install completions](./cli-options.md#install-completions-options), [logging](./cli-options.md#logging-options), [verbosity](./cli-options.md#verbosity-options) ### install-home -Install Scala CLI in a sub-directory of the home directory + Accepts option groups: [install home](./cli-options.md#install-home-options), [logging](./cli-options.md#logging-options), [verbosity](./cli-options.md#verbosity-options) @@ -163,17 +255,23 @@ Accepts option groups: [install home](./cli-options.md#install-home-options), [l Generates a BSP file that you can import into your IDE. -You are currently viewing the basic help for the setup-ide sub-command. You can view the full help by running: - scala-cli setup-ide --help-full +The setup-ide sub-command allows to pre-configure a Scala CLI project to import to an IDE with BSP support. +It is also ran implicitly when `compile`, `run`, `shebang` or `test` sub-commands are called. + +The pre-configuration should be saved in a BSP json connection file under the path: + {project-root}/.bsp/scala-cli.json + +Specific setup-ide configurations can be specified with both command line options and using directives defined in sources. +Command line options always take priority over using directives when a clash occurs, allowing to override configurations defined in sources. +Using directives can be defined in all supported input source file types. + For detailed documentation refer to our website: https://scala-cli.virtuslab.org/docs/commands/setup-ide Accepts option groups: [bsp file](./cli-options.md#bsp-file-options), [compilation server](./cli-options.md#compilation-server-options), [coursier](./cli-options.md#coursier-options), [debug](./cli-options.md#debug-options), [dependency](./cli-options.md#dependency-options), [help group](./cli-options.md#help-group-options), [input](./cli-options.md#input-options), [jvm](./cli-options.md#jvm-options), [logging](./cli-options.md#logging-options), [markdown](./cli-options.md#markdown-options), [python](./cli-options.md#python-options), [Scala.js](./cli-options.md#scalajs-options), [Scala Native](./cli-options.md#scala-native-options), [scalac](./cli-options.md#scalac-options), [scalac extra](./cli-options.md#scalac-extra-options), [setup IDE](./cli-options.md#setup-ide-options), [shared](./cli-options.md#shared-options), [snippet](./cli-options.md#snippet-options), [suppress warning](./cli-options.md#suppress-warning-options), [verbosity](./cli-options.md#verbosity-options), [workspace](./cli-options.md#workspace-options) ### uninstall -Uninstalls Scala CLI. -Works only when installed with the installation script. -For detailed installation instructions refer to our website: https://scala-cli.virtuslab.org/install + Accepts option groups: [compilation server](./cli-options.md#compilation-server-options), [coursier](./cli-options.md#coursier-options), [logging](./cli-options.md#logging-options), [uninstall](./cli-options.md#uninstall-options), [uninstall completions](./cli-options.md#uninstall-completions-options), [verbosity](./cli-options.md#verbosity-options) @@ -183,8 +281,6 @@ Aliases: `uninstall-completions` Uninstalls Scala CLI completions from your shell. -You are currently viewing the basic help for the uninstall completions sub-command. You can view the full help by running: - scala-cli uninstall completions --help-full For detailed documentation refer to our website: https://scala-cli.virtuslab.org/docs/commands/completions Accepts option groups: [logging](./cli-options.md#logging-options), [uninstall completions](./cli-options.md#uninstall-completions-options), [verbosity](./cli-options.md#verbosity-options) @@ -195,8 +291,6 @@ Updates Scala CLI. Works only when installed with the installation script. If Scala CLI was installed with an external tool, refer to its update methods. -You are currently viewing the basic help for the update sub-command. You can view the full help by running: - scala-cli update --help-full For detailed installation instructions refer to our website: https://scala-cli.virtuslab.org/install Accepts option groups: [logging](./cli-options.md#logging-options), [update](./cli-options.md#update-options), [verbosity](./cli-options.md#verbosity-options) diff --git a/website/docs/reference/scala-command/runner-specification.md b/website/docs/reference/scala-command/runner-specification.md index b3efed9987..d2cb6371d9 100644 --- a/website/docs/reference/scala-command/runner-specification.md +++ b/website/docs/reference/scala-command/runner-specification.md @@ -48,8 +48,16 @@ are assumed to be Scala compiler options and will be propagated to Scala Compile Compile Scala code. -You are currently viewing the basic help for the compile sub-command. You can view the full help by running: - scala-cli compile --help-full +Specific compile configurations can be specified with both command line options and using directives defined in sources. +Command line options always take priority over using directives when a clash occurs, allowing to override configurations defined in sources. +Using directives can be defined in all supported input source file types. + +Multiple inputs can be passed at once. +Paths to directories, URLs and supported file types are accepted as inputs. +Accepted file extensions: .scala, .sc, .java, .jar, .md, .jar, .c, .h, .zip +For piped inputs use the corresponding alias: _.scala, _.java, _.sc, _.md +All supported types of inputs can be mixed with each other. + For detailed documentation refer to our website: https://scala-cli.virtuslab.org/docs/commands/compile ### MUST have options @@ -567,8 +575,15 @@ Aliases: `--toolkit` Configure global settings for Scala CLI. -You are currently viewing the basic help for the config sub-command. You can view the full help by running: - scala-cli config --help-full +Syntax: +```sh + scala-cli config key value +``` +For example, to globally set the interactive mode: +```sh + scala-cli config interactive true +``` + For detailed documentation refer to our website: https://scala-cli.virtuslab.org/docs/commands/misc/config ### SHOULD have options @@ -700,8 +715,12 @@ Dump config DB as JSON Generate Scaladoc documentation. -You are currently viewing the basic help for the doc sub-command. You can view the full help by running: - scala-cli doc --help-full +Multiple inputs can be passed at once. +Paths to directories, URLs and supported file types are accepted as inputs. +Accepted file extensions: .scala, .sc, .java, .jar, .md, .jar, .c, .h, .zip +For piped inputs use the corresponding alias: _.scala, _.java, _.sc, _.md +All supported types of inputs can be mixed with each other. + For detailed documentation refer to our website: https://scala-cli.virtuslab.org/docs/commands/doc ### MUST have options @@ -1217,8 +1236,18 @@ Aliases: `console` Fire-up a Scala REPL. -You are currently viewing the basic help for the repl sub-command. You can view the full help by running: - scala-cli repl --help-full +The entire Scala CLI project's classpath is loaded to the repl. + +Specific repl configurations can be specified with both command line options and using directives defined in sources. +Command line options always take priority over using directives when a clash occurs, allowing to override configurations defined in sources. +Using directives can be defined in all supported input source file types. + +Multiple inputs can be passed at once. +Paths to directories, URLs and supported file types are accepted as inputs. +Accepted file extensions: .scala, .sc, .java, .jar, .md, .jar, .c, .h, .zip +For piped inputs use the corresponding alias: _.scala, _.java, _.sc, _.md +All supported types of inputs can be mixed with each other. + For detailed documentation refer to our website: https://scala-cli.virtuslab.org/docs/commands/repl ### MUST have options @@ -1742,8 +1771,25 @@ Don't actually run the REPL, just fetch it Compile and run Scala code. -You are currently viewing the basic help for the run sub-command. You can view the full help by running: - scala-cli run --help-full +Specific run configurations can be specified with both command line options and using directives defined in sources. +Command line options always take priority over using directives when a clash occurs, allowing to override configurations defined in sources. +Using directives can be defined in all supported input source file types. + +For a run to be successful, a main method must be present on the classpath. +.sc scripts are an exception, as a main class is provided in their wrapper. + +Multiple inputs can be passed at once. +Paths to directories, URLs and supported file types are accepted as inputs. +Accepted file extensions: .scala, .sc, .java, .jar, .md, .jar, .c, .h, .zip +For piped inputs use the corresponding alias: _.scala, _.java, _.sc, _.md +All supported types of inputs can be mixed with each other. + +To pass arguments to the actual application, just add them after `--`, like: + +```sh +scala-cli run Main.scala AnotherSource.scala -- first-arg second-arg +``` + For detailed documentation refer to our website: https://scala-cli.virtuslab.org/docs/commands/run ### MUST have options @@ -2287,8 +2333,29 @@ Run Java commands using a manifest-based class path (shortens command length) Like `run`, but handier for shebang scripts. -You are currently viewing the basic help for the shebang sub-command. You can view the full help by running: - scala-cli shebang --help-full +This command is equivalent to the `run` sub-command, but it changes the way +Scala CLI parses its command-line arguments in order to be compatible +with shebang scripts. + +When relying on the `run` sub-command, inputs and scala-cli options can be mixed, +while program args have to be specified after `--` +```sh + scala-cli [command] [scala-cli_options | input]... -- [program_arguments]... +``` + +However, for the `shebang` sub-command, only a single input file can be set, while all scala-cli options +have to be set before the input file. +All inputs after the first are treated as program arguments, without the need for `--` +```sh + scala-cli shebang [scala-cli_options]... input [program_arguments]... +``` + +Using this, it is possible to conveniently set up Unix shebang scripts. For example: +```scala + #!/usr/bin/env -S scala-cli shebang --scala-version 2.13 + println("Hello, world") +``` + For detailed documentation refer to our website: https://scala-cli.virtuslab.org/docs/commands/shebang ### MUST have options @@ -2836,8 +2903,13 @@ Aliases: `format`, `scalafmt` Formats Scala code. -You are currently viewing the basic help for the fmt sub-command. You can view the full help by running: - scala-cli fmt --help-full +`scalafmt` is used to perform the formatting under the hood. + +The `.scalafmt.conf` configuration file is optional. +Default configuration values will be assumed by Scala CLI. + +All standard Scala CLI inputs are accepted, but only Scala sources will be formatted (.scala and .sc files). + For detailed documentation refer to our website: https://scala-cli.virtuslab.org/docs/commands/fmt ### MUST have options @@ -3395,8 +3467,22 @@ Aliases: `--fmt-version` Compile and test Scala code. -You are currently viewing the basic help for the test sub-command. You can view the full help by running: - scala-cli test --help-full +Test sources are compiled separately (after the 'main' sources), and may use different dependencies, compiler options, and other configurations. +A source file is treated as a test source if: + - it contains the `//> using target.scope "test"` directive + - the file name ends with `.test.scala` + - the file comes from a directory that is provided as input, and the relative path from that file to its original directory contains a `test` directory + +Specific test configurations can be specified with both command line options and using directives defined in sources. +Command line options always take priority over using directives when a clash occurs, allowing to override configurations defined in sources. +Using directives can be defined in all supported input source file types. + +Multiple inputs can be passed at once. +Paths to directories, URLs and supported file types are accepted as inputs. +Accepted file extensions: .scala, .sc, .java, .jar, .md, .jar, .c, .h, .zip +For piped inputs use the corresponding alias: _.scala, _.java, _.sc, _.md +All supported types of inputs can be mixed with each other. + For detailed documentation refer to our website: https://scala-cli.virtuslab.org/docs/commands/test ### MUST have options @@ -3926,10 +4012,14 @@ Aliases: `--java-prop` ## `version` command **SHOULD have for Scala Runner specification.** -Prints the version of the Scala CLI and the default version of Scala. +Prints the version of the Scala CLI and the default version of Scala. (which can be overridden in the project) +If network connection is available, this sub-command also checks if the installed Scala CLI is up-to-date. + +The version of the Scala CLI is the version of the command-line tool that runs Scala programs, which +is distinct from the Scala version of the compiler. We recommend to specify the version of the Scala compiler +for a project in its sources (via a using directive). Otherwise, Scala CLI falls back to the default +Scala version defined by the runner. -You are currently viewing the basic help for the version sub-command. You can view the full help by running: - scala-cli version --help-full For detailed documentation refer to our website: https://scala-cli.virtuslab.org/docs/commands/version
@@ -4011,8 +4101,12 @@ Don't check for the newest available Scala CLI version upstream Start BSP server. -You are currently viewing the basic help for the bsp sub-command. You can view the full help by running: - scala-cli bsp --help-full +BSP stands for Build Server Protocol. +For more information refer to https://build-server-protocol.github.io/ + +This sub-command is not designed to be used by a human. +It is normally supposed to be invoked by your IDE when a Scala CLI project is imported. + Detailed documentation can be found on our website: https://scala-cli.virtuslab.org ### MUST have options @@ -4512,8 +4606,8 @@ Command-line options JSON file Clean the workspace. -You are currently viewing the basic help for the clean sub-command. You can view the full help by running: - scala-cli clean --help-full +Passed inputs will establish the Scala CLI project, for which the workspace will be cleaned. + For detailed documentation refer to our website: https://scala-cli.virtuslab.org/docs/commands/clean
@@ -4587,7 +4681,7 @@ Directory where .scala-build is written ## `help` command **IMPLEMENTATION specific for Scala Runner specification.** -Print help message +
@@ -4648,8 +4742,6 @@ Aliases: `install-completions` Installs Scala CLI completions into your shell -You are currently viewing the basic help for the install completions sub-command. You can view the full help by running: - scala-cli install completions --help-full For detailed documentation refer to our website: https://scala-cli.virtuslab.org/docs/commands/completions
@@ -4735,7 +4827,7 @@ Print completions to stdout ## `install-home` command **IMPLEMENTATION specific for Scala Runner specification.** -Install Scala CLI in a sub-directory of the home directory +
@@ -4816,8 +4908,16 @@ Binary directory Generates a BSP file that you can import into your IDE. -You are currently viewing the basic help for the setup-ide sub-command. You can view the full help by running: - scala-cli setup-ide --help-full +The setup-ide sub-command allows to pre-configure a Scala CLI project to import to an IDE with BSP support. +It is also ran implicitly when `compile`, `run`, `shebang` or `test` sub-commands are called. + +The pre-configuration should be saved in a BSP json connection file under the path: + {project-root}/.bsp/scala-cli.json + +Specific setup-ide configurations can be specified with both command line options and using directives defined in sources. +Command line options always take priority over using directives when a clash occurs, allowing to override configurations defined in sources. +Using directives can be defined in all supported input source file types. + For detailed documentation refer to our website: https://scala-cli.virtuslab.org/docs/commands/setup-ide ### MUST have options @@ -5327,9 +5427,7 @@ Aliases: `--name` ## `uninstall` command **IMPLEMENTATION specific for Scala Runner specification.** -Uninstalls Scala CLI. -Works only when installed with the installation script. -For detailed installation instructions refer to our website: https://scala-cli.virtuslab.org/install +
@@ -5492,8 +5590,6 @@ Aliases: `uninstall-completions` Uninstalls Scala CLI completions from your shell. -You are currently viewing the basic help for the uninstall completions sub-command. You can view the full help by running: - scala-cli uninstall completions --help-full For detailed documentation refer to our website: https://scala-cli.virtuslab.org/docs/commands/completions
@@ -5567,8 +5663,6 @@ Updates Scala CLI. Works only when installed with the installation script. If Scala CLI was installed with an external tool, refer to its update methods. -You are currently viewing the basic help for the update sub-command. You can view the full help by running: - scala-cli update --help-full For detailed installation instructions refer to our website: https://scala-cli.virtuslab.org/install