-
Notifications
You must be signed in to change notification settings - Fork 129
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
Show help document if for the invalid subcommand #1240
Comments
Hey, good point. EDIT: scala-cli invalid Scala CLI looks for defined sub-commands and figures So, scala-cli Main.scala is actually the equivalent of scala-cli run Main.scala This is why the exception you are receiving is an Now, I agree that better error handling and an informative error message would be in place, but one needs to keep this context in mind. |
This implicit dispatching mechanism to For example, having a project in a dir called ❯❯❯ cat test/Example.scala
object Hello {
def main(args: Array[String]): Unit =
println("Hello from Scala")
}
❯❯❯ scala-cli test # this should run my project
[error] No inputs provided (expected files with .scala or .sc extensions, and / or directories).
❯❯❯ scala-cli run test
Hello from Scala
❯❯❯ scala-cli test test
No test framework found For every subcommand (e.g., I suspect the motivation for this implicit dispatching design is to mimic the I somewhat understand the motivation for this implicit dispatch model, however, I'm not sure it really adds enough value versus an explicit call to the subcommand (e.g., Also, for a data point, when I started using |
@mpkocher it is currently likely that the implicit dispatching mechanism to the I am not yet sure if that'd mean only running So the TL;DR is, let's hold our horses for a bit with this. The exception handling proposed by @tanishiking definitely still applies, but we should keep the above in mind when improving anything surrounding it. |
The |
The current behaviour of
▶ scala-cli invalid
[error] invalid: not found Example desired behaviours:
▶ scala-cli invalid
[error] 'invalid' is not a scala-cli sub-command, and it is not a valid path to an inputs directory, either.
Usage: scala-cli <COMMAND>
Scala CLI is a command-line tool to interact with the Scala language.
(...)
▶ scala-cli ValidInput.scala invalid
[error] 'invalid' is not a valid path to an input.
▶ scala-cli InvalidInput.scala
[error] 'InvalidInput.scala' is not a valid path to an input. Invalid remote args (i.e. invalid URLs) should not be handled as part of this ticket. |
Is your feature request related to a problem? Please describe.
If I provide an invalid subcommand to
scala-cli
, it shows a stacktrace.Describe the solution you'd like
It would be helpful if
scala-cli
shows a help document (that is shown when we typescala-cli help
) when we provide an invalid subcommandDescribe alternatives you've considered
It might be better to show a small error message that recommends users to run
scala-cli help
.For example, git command shows the following message for invalid command.
Additional context
none
The text was updated successfully, but these errors were encountered: