-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
Introduce config-based command line argument binding #6497
Comments
There also should be a way to optionally bind the remaining arguments to a configuration item. It should automatically "listify" the values. |
Will this auto-read of arguments and then removal before calling to user own "main" be forced or something that user can turn on/off ? And how about when user have their own validation and shell completion support; like what picocli can provide - how would such libraries become aware of these "magical" property settings ? |
I would think it would probably be forced, otherwise we could end up with some truly bizarre behavior.
I'm not sure what the right solution is for this, but I do know that this is a problem that has to be solved twice: once because we consume some arguments, and once again because GraalVM's main method consumes some more arguments. |
oh - what are those ? |
one way could be to pass arguments like this: |
|
ah so doing -Qxx=yy wouldn't be that far fetched ? |
My list was not exhaustive and I definitely didn't mean to suggest that there is some uniform syntax for Graalvm arguments (afaik there isn't). |
thanks @magicprinc it does seem like a simple way of doing it. and we could just do it and possibly provide a |
@maxandersen That sounds like it could work. Also, @dmlloyd's PR description seems on point to what needs to be done |
@gastaldi different from what smallrye/smallrye-config#290 did/does? |
@maxandersen I think it's similar, but missing the validation and parsing features specified. I remember checking https://github.com/jopt-simple/jopt-simple as an attempt to fulfill those requirements but it fell into the cracks |
Description
Introduce a way to bind command line arguments to configuration values.
@ConfigItem
corresponds to a command line argument with long and/or short forms and the corresponding configuration property name, with a sensible default naming strategy for the long form (if any)BuildItem
to carry this information, which is produced byExtensionLoader
when the config items are discoveredConfigSource
implementation which accepts aString[]
representing the command line arguments, and also provides access to a "cleaned"String[]
with the predefined arguments removed (NOTE: this should be contributed directly to [SmallRye Config](https://github.com/smallrye/config - tag @dmlloyd on the PR)io.quarkus.deployment.configuration.RunTimeConfigurationGenerator
)Requirements
--arg-name=foo
and--arg-name
foo
should both be allowed for long arguments with a simple value;-xfoo
and-x foo
are accepted forms for short arguments with required values; maybe consider optionally supporting the common--foo
/--no-foo
and/or--with-foo
/--without-foo
and/or--enable-foo
/--disable-foo
styles as well)-x
(optionality can not be supported for these)IllegalArgumentException
-a
-b
-c
=>-abc
, but this does not need to be supported--
indicates the end of the interpreted arguments (the rest of the arguments are passed through)The text was updated successfully, but these errors were encountered: