question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Running Scala CLI without any arguments should start a REPL

See original GitHub issue

Is your feature request related to a problem? Please describe.

This issue was created based on the comments in Scala CLI SIP.

The current scala command starts repl with no arguments provided but with scala-cli repl subcommand is needed. I think we should change the behaviour to match what scala is doing now: running repl when no commands are provided.

Describe the solution you’d like

When running scala-cli without any command, a reply should be started.

Additional context

We would need to find a way to display help for the whole scala-cli' tool. With the default changed, user running scala-cli --helpmay expect either help for the wholescala-clior therepl` command. I can see 2 options:

  • scala-cli --help prints the help for the whole tool with the mention that to see a help dedicated for repl command run scala-cli repl --help
  • scala-cli --help prints the help for repl command with the mention that to see the whole help run e.g. scala-cli --help --all

I am personally prefer the former mechanism.

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:6 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
Gedochaocommented, Aug 17, 2022

CLI tools typically print the help text on bad usage. We can keep only the “traditional” -h and --help. Even if you type nonexistent switch (like -help), you will still be show the help text.

FYI we already have a ticket for this: https://github.com/VirtusLab/scala-cli/issues/1240

1reaction
bjornregnellcommented, Aug 16, 2022

It would be good to make sure that it also works as before with scala-cli to give the -S or --scala-version options (and perhaps other relevant options to scala-cli). So instead of:

$ scala-cli repl -S 2
Welcome to Scala 2.13.8 (OpenJDK 64-Bit Server VM, Java 17.0.3).
Type in expressions for evaluation. Or try :help.

scala> 

$ scala-cli repl -S 3
Welcome to Scala 3.1.3 (17.0.3, Java OpenJDK 64-Bit Server VM).
Type in expressions for evaluation. Or try :help.

scala> 

We can write just:

$ scala -S 2
Welcome to Scala 2.13.8 (OpenJDK 64-Bit Server VM, Java 17.0.3).
Type in expressions for evaluation. Or try :help.

scala> 

$ scala -S 3
Welcome to Scala 3.1.3 (17.0.3, Java OpenJDK 64-Bit Server VM).
Type in expressions for evaluation. Or try :help.

scala> 

Read more comments on GitHub >

github_iconTop Results From Across the Web

Getting started | Scala CLI
In this article we show how to use Scala CLI to create a basic script, followed by small project with features like dependencies,...
Read more >
Scala CLI (Compiling and Running Code) | alvinalexander.com
Use this Scala CLI command to start the Scala REPL: ... is implicitly made available to you, so you can access command-line arguments....
Read more >
The Scala REPL | Scala Book
The Scala REPL (“Read-Evaluate-Print-Loop”) is a command-line interpreter that you use as a “playground” area to test your Scala code. To start a...
Read more >
How do I set command line arguments for my REPL - Replit
Press Ctrl-Shift-P inside your repl and then "Open Shell". This will open a normal shell inside your repl directory, where you can run...
Read more >
Introduction to Scala REPL - Baeldung
Scala REPL is a command-line tool for the expression, evaluation, ... To start a Scala REPL session, we need to execute the “scala”...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found