Closed TobseF closed 10 months ago
The -Dname=value method is the intended way of passing command-line arguments. You access them in your script as though they were config parameters. You don't need a .conf file, but if you did have one, you actually could supply defaults in the .conf and then simply override them on the command-line.
The main reason I never added true command-line arguments is that you can technically ask blaze to run multiple tasks at a time -- e.g. "blaze a b c" where a, b, and c are all separate tasks. You'd then require some convoluted strategy of "blaze a [args for a] b [args for b] c [args for c]" kind of syntax. Thus, I actually thought the config -Dname=value strategy for passing values is somewhat superior in a way.
On Tue, Apr 3, 2018 at 4:34 PM, Tobse notifications@github.com wrote:
Can I provide arguments which blaze passes to the script? So it would be possible to write:
fun main(args: Array
) { print(args) } and call java -jar blaze.jar -args mySuperArgument ?
I saw the blaze.conf https://github.com/fizzed/blaze/blob/master/docs/CONFIG.md property option. But in this way I have to add a blaze dependency / import to my script, which I want to avoid. And it's not flexible enough like arguments.
Or is the java -Dname=value the only possibility to pass an argument to a script? Which is not typical if i run the script without blaze, or want to test it with JUnit.
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/fizzed/blaze/issues/13, or mute the thread https://github.com/notifications/unsubscribe-auth/AAjwAmW0_dsT2pGr1JmCoZew10KYHxSOks5tk9zOgaJpZM4TFvhi .
Thanks for the fast reply. Your idea with the config strategy sounds reasonable, and of course works pretty well in my case. To make it easier to migrate existing scripts something like a -a|--args
options could help.
It'd be fairly straight forward to convert "-a arg" to simply by an alias to "-Da=arg" in the java boostrap code. I'd be supportive of a PR that implemented that kind of feature.
On Tue, Apr 3, 2018 at 5:45 PM, Tobse notifications@github.com wrote:
Thanks for the fast reply. Your idea with the config strategy sounds reasonable, and of course works pretty well in my case. To make it easier to migrate existing scripts something like a -a|--args options could help.
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/fizzed/blaze/issues/13#issuecomment-378409695, or mute the thread https://github.com/notifications/unsubscribe-auth/AAjwAggfT0t48AjkcR5sssanBh_S5SLjks5tk-2SgaJpZM4TFvhi .
Cleaning up old issues. This was addressed in recent blaze versions where "--argument" is now supported.
Can I provide arguments which blaze passes to the script? So it would be possible to write:
and call
java -jar blaze.jar -args mySuperArgument
?I saw the blaze.conf property option. But in this way I have to add a blaze dependency / import to my script, which I want to avoid. And it's not flexible enough like arguments.
Or is the java
-Dname=value
the only possibility to pass an argument to a script? Which is not typical if i run the script without blaze, or want to test it with JUnit.