Skip to main content

Commands

about

Print details about this application

Accepts options:

clean

Clean the workspace

Accepts options:

compile

Compile Scala code

Accepts options:

doctor

Print details about this application

Accepts options:

export

Export current project to sbt or Mill

Accepts options:

fmt

Aliases:

  • format
  • scalafmt

Format Scala code

Accepts options:

help

Print help message

install completions

Aliases:

  • install-completions

Installs completions into your shell

Accepts options:

console

Aliases:

  • repl

Fire-up a Scala REPL

Accepts options:

package

Compile and package Scala code

Accepts options:

publish

Accepts options:

run

Compile and run Scala code.

To pass arguments to the application, just add them after --, like:

scala-cli MyApp.scala -- first-arg second-arg

Accepts options:

setup-ide

Generate a BSP file that you can import into your IDE

Accepts options:

shebang

Like run, but more handy from shebang scripts

This command is equivalent to run, but it changes the way scala-cli parses its command-line arguments in order to be compatible with shebang scripts.

Normally, inputs and scala-cli options can be mixed. Program have to be specified after --

scala-cli [command] [scala_cli_options | input]... -- [program_arguments]...

Contrary, for shebang command, only a single input file can be set, all scala-cli options have to be set before the input file, and program arguments after the input file

scala-cli shebang [scala_cli_options]... input [program_arguments]...

Using this, it is possible to conveniently set up Unix shebang scripts. For example:

#!/usr/bin/env -S scala-cli shebang --scala-version 2.13
println("Hello, world)

Accepts options:

test

Compile and test Scala code

Accepts options:

update

Update scala-cli - it works only for installation script

Accepts options:

version

Print scala-cli version

Accepts options:

Hidden commands

add-path

Accepts options:

bloop exit

Accepts options:

bloop start

Accepts options:

bsp

Start BSP server

Accepts options:

directories

Prints directories used by scala-cli

Accepts options:

install-home

Install scala-cli in a sub-directory of the home directory

Accepts options:

browse

Aliases:

  • metabrowse

Browse Scala code and its dependencies in the browser

Accepts options:

pgp create

Create PGP key pair

Accepts options:

pgp sign

Sign files with PGP

Accepts options:

pgp verify

Verify PGP signatures

Accepts options: