Make inputs optional when -classpath
and --main-class
are passed
#1369
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Context
The
scala
command allows to do the following:Meanwhile, Scala CLI:
-classpath
option out of the blue will just start the repl with the relevant classpath. this still allows to run whatever you want in the repl. We are keeping this behaviour.--main-class
option, similarly to how thescala
command allows to pass it as an input.This fails, as
--main-class
isn't an option for the repl, and we are defaulting to the repl.Still, if we pass the
run
sub-command explicitly, it fails as well.Even though the main class is specified and it is indeed passed on the classpath,
scala-cli
fails because it expects inputs.After the changes
TL;DR the following syntax becomes available:
run
sub-command is passed explicitly, it's sufficient to have a main class on the classpath, inputs aren't necessary then--main-class
has to be passed explicitly (even if there's only one main class on the classpath) to indicate the intent of running it instead of defaulting to the repl-classpath
still defaults to therepl