jbang
jbang copied to clipboard
Support specifying system properties when installing app
Is your feature request related to a problem? Please describe.
Discussed in https://github.com/jbangdev/jbang/discussions/1736
Originally posted by tadayosi January 23, 2024 When we install an app from a remote catalog like:
jbang app install hawtio@hawtio/hawtio
it will create a local script such as:
$ cat .jbang/bin/hawtio
#!/bin/sh
exec jbang run hawtio@hawtio/hawtio "$@"
but sometimes we might want to specify some system properties to customise the installed app. So far it appears we can only do so by manually modifying the generated script:
#!/bin/sh
exec jbang run -Dhawtio.jbang.version=4.0.0.redhat-00029 hawtio@hawtio/hawtio "$@"
Is there a smarter way to achieve the same thing? If there isn't, it might be a good feature enhancement for jbang app install
.
Describe the solution you'd like
jbang app install
would accept parameters after <scriptRef>
something like this:
jbang app install hawtio@hawtio/hawtio -Dhawtio.jbang.version=4.0.0.redhat-00029
and they are inserted between jbang run
and <scriptRef> "$@"
in the installed script.
Describe alternatives you've considered
Or perhaps, jbang app install
can provide yet another parameter like --run-params
and the user might be able to run it like this:
jbang app install --run-params="-Dhawtio.jbang.version=4.0.0.redhat-00029" hawtio@hawtio/hawtio
Additional context Hawtio provides JBang CLI and wants to let users specify a custom version to run Hawtio. https://github.com/hawtio/hawtio/pull/3186
@maxandersen what about extending app install
from run
? That way it would have all the same options as run. We'd get all the picocli help for all the options as well (although their descriptions might suggest they are either to be used for building or running, not for installing apps). We'd be able to do jbang app install --name fubar ...any other build/run options here... <scriptRef> ...any arguments here...
. Wdyt?
Bunch of them wouldn't be great to have on install though. Maybe move the shared ones to a mix in or new common base ?
@maxandersen sure I'm probably not advocating to actually have it extend run
, because that would also inherit completely unneeded code. So we'd definitely be talking about mixins and the like. But... I wonder, what options from would you not want on install? Are there any options that would really never make sense within an installed script?