Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve the error message for when a build's main class is ambiguous #1323

Merged
merged 3 commits into from Sep 6, 2022

Conversation

Gedochao
Copy link
Contributor

@Gedochao Gedochao commented Sep 5, 2022

Fixes #1315

Before:

$ scala-cli run .
[error]  Found several main classes: ScalaMainClass2, ScalaMainClass1, scripts.ScalaScript_sc

After these changes:

$ scala-cli run .
[error]  Found several main classes: ScalaMainClass1, ScalaMainClass2, scripts.ScalaScript_sc
You can run one of them by passing it with the --main-class option, e.g.
  scala-cli . --main-class ScalaMainClass1

You can pick the main class interactively by passing the --interactive option.
  scala-cli . --interactive

@Gedochao Gedochao added the enhancement New feature or request label Sep 5, 2022
@Gedochao Gedochao marked this pull request as draft September 5, 2022 18:01
@Gedochao Gedochao force-pushed the improve-error-messages branch 2 times, most recently from e942851 to f7d0024 Compare September 6, 2022 10:38
@Gedochao Gedochao marked this pull request as ready for review September 6, 2022 13:45
Copy link
Contributor

@alexarchambault alexarchambault left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok to merge, but just so you know, initially, for command suggestions such as these, my plan was to handle those like this one, that is catching specific exceptions in ScalaCli, and print suggestions for them.

That way, CLI-specific concerns don't leak in the build module. Originally, my intent was to maybe allow the build modules to be used as a library, where the CLI isn't around. So these suggestions don't make sense there. That said, I'm not sure the build modules are going to be used this way at some point, so it's no big deal...

@Gedochao Gedochao merged commit 5dc16d1 into VirtusLab:main Sep 6, 2022
@Gedochao Gedochao deleted the improve-error-messages branch September 6, 2022 14:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

give hint on what to do when [error] Found several main classes
2 participants