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

app should exit with non-zero exit code and usage/help text when no argument provided #132

Open
kpritam opened this issue Jul 19, 2019 · 1 comment

Comments

@kpritam
Copy link

kpritam commented Jul 19, 2019

If you run following example without providing any arguments, app exits with zero exit code without help/usage

sealed trait DemoCommand
case class First(foo: Int, bar: String) extends DemoCommand
case class Second(baz: Double) extends DemoCommand

object MyApp extends CommandApp[DemoCommand] {
  def run(command: DemoCommand, args: RemainingArgs): Unit = {}
}
@AlexanderRay
Copy link

Just use

 override def main(args: Array[String]): Unit = {
    if (args.isEmpty) {
      helpAsked()
    } else super.main(args)
  }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants