jbang icon indicating copy to clipboard operation
jbang copied to clipboard

Support specifying system properties when installing app

Open tadayosi opened this issue 1 year ago • 3 comments

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

tadayosi avatar Jan 23 '24 11:01 tadayosi

@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?

quintesse avatar Jan 23 '24 12:01 quintesse

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 avatar Jan 24 '24 20:01 maxandersen

@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?

quintesse avatar Jan 24 '24 21:01 quintesse