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

How to customize launcher script's -h output to include my application's own options? #831

Closed
alexeyr opened this issue Jun 30, 2016 · 6 comments
Labels
feature request universal Zip, tar.gz, tgz and bash issues

Comments

@alexeyr
Copy link

alexeyr commented Jun 30, 2016

I would expect this to be a common requirement, but couldn't find it in http://www.scala-sbt.org/sbt-native-packager/archetypes/java_app/index.html.

@alexeyr alexeyr changed the title How to customize Bash/Bat script -h output to include my application's own options? How to customize launcher script's -h output to include my application's own options? Jun 30, 2016
@muuki88 muuki88 added universal Zip, tar.gz, tgz and bash issues feature request labels Jul 1, 2016
@muuki88
Copy link
Contributor

muuki88 commented Jul 1, 2016

Thanks for your feature request, but I think this feature is out of scope for native packager.

The command line options are for the start script alone. I can't see the advantage in defining your cli options in the bash script and in your application. If you use scopt or finagle flags you will get parsing, validating and help messages all in one.

@muuki88 muuki88 closed this as completed Jul 1, 2016
@alexeyr
Copy link
Author

alexeyr commented Jul 1, 2016

That's precisely it: if the users pass -h or -help, they get one set of options; if they pass --help (or perhaps -- -h), they get another. And the usage message of the start script can't tell them about --help.

@alexeyr
Copy link
Author

alexeyr commented Jul 1, 2016

I definitely wouldn't want to define the options in two places.

@muuki88
Copy link
Contributor

muuki88 commented Jul 1, 2016

So a more helpful help message from the bash start-script would at least ease this confusion? There is a friction between the built application and the default start script. I'm not sure how we could close this gap in a user friendly and easy way.

@alexeyr
Copy link
Author

alexeyr commented Jul 1, 2016

Yes. One approach I thought of is to have an SBT setting telling sbt-native-packager what arguments to pass for usage information. If it's e.g. Some("--help"), <start-script> -h ends with printing Usage message for the application: and then calling <java-command> --help.

@muuki88
Copy link
Contributor

muuki88 commented Jul 3, 2016

Yeah, that would be possible, but can get tricky.

  1. Custom mainClass definitions must be taken into account when processing the app args
  2. What usage is printed on an invalid input?
  3. What happens with non-parsed inputs?

I'm not saying this is not possible, nor not useful. My main concern is making the bash-script more complex that it already is. If the "usage printing logic" can be optionally plugged in, then this would be nice, but I fear this is not simple possible either.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request universal Zip, tar.gz, tgz and bash issues
Projects
None yet
Development

No branches or pull requests

2 participants