Skip to content

Conversation

Gedochao
Copy link
Contributor

@Gedochao Gedochao commented Nov 16, 2022

Closes #1370

This is an attempt at explaining the default sub-command behaviour in the CLI -help as well (as until now it was only mentioned on the docs website).

▶ scala-cli -help
Usage: /Users/pchabelski/IdeaProjects/scala-cli/out/cli/base-image/nativeImage.dest/scala-cli <COMMAND>
Scala CLI is a command-line tool to interact with the Scala language. It lets you compile, run, test, and package your Scala code.

Other commands:
  export                                        Export current project to sbt or Mill
  help                                          Print help message
  install completions, install-completions      Installs completions into your shell
  github secret create, gh secret create
  github secret list, gh secret list
  setup-ide                                     Generate a BSP file that you can import into your IDE
  shebang                                       Like `run`, but more handy from shebang scripts
  uninstall                                     Uninstall scala-cli - only works when installed by the installation script
  uninstall completions, uninstall-completions  Uninstalls completions from your shell
  update                                        Update scala-cli - only works when installed by the installation script

Doctor commands:
  doctor  Print details about this application

Main commands:
  clean                  Clean the workspace
  compile                Compile Scala code
  dependency-update      Update dependencies in project
  doc                    Generate Scaladoc documentation
  fmt, format, scalafmt  Format Scala code
  repl, console          Fire-up a Scala REPL
  package                Compile and package Scala code
  publish
  publish local
  publish setup
  run                    Compile and run Scala code.
  test                   Compile and test Scala code

Miscellaneous commands:
  about    Print details about this application
  version  Print version

See 'scala-cli <command> --help' to read about a specific subcommand. To see full help run 'scala-cli <command> --help-full'.
To run another Scala CLI version, specify it with '--cli-version' before any other argument, like 'scala-cli --cli-version <version> args'.

When no subcommand is passed explicitly, an implicit subcommand is used based on context:
  - if the '--version' option is passed, it prints the 'version' subcommand output, unmodified by any other options
  - if any inputs were passed, it defaults to the 'run' subcommand
  - additionally, when no inputs were passed, it defaults to the 'run' subcommand in the following scenarios:
    - if a snippet was passed with any of the '--execute*' options
    - if a main class was passed with the '--main-class' option alongside an extra '--classpath'
  - otherwise, if no inputs were passed, it defaults to the 'repl' subcommand

@Gedochao Gedochao added the SIP-46 All the issues related to SIP-46 to turn Scala CLI into the official scala runner command. label Nov 16, 2022
@Gedochao Gedochao force-pushed the better-help-for-default-subcommand branch 4 times, most recently from 84fbb6f to ab81153 Compare November 16, 2022 14:59
@Gedochao Gedochao force-pushed the better-help-for-default-subcommand branch from ab81153 to a18cf9d Compare November 17, 2022 07:28
@Gedochao Gedochao merged commit 30504be into VirtusLab:main Nov 17, 2022
@Gedochao Gedochao deleted the better-help-for-default-subcommand branch November 17, 2022 09:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
SIP-46 All the issues related to SIP-46 to turn Scala CLI into the official scala runner command.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Improve documentation and --help in the context of SIP-46-related changes
2 participants