-
Notifications
You must be signed in to change notification settings - Fork 120
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
"Dynamic parameters" support? #166
Comments
That's not currently possible with Clikt, since it would require changes to the parser. Can you share your use case and (if you know of any) existing apps that use dynamic options? |
E.g. Gradle uses that type of option to pass system properties or project properties on the command line, and I believe Maven has the same (at least for |
So looking into Jcommander and gradle's In gradle, all of the following are equivalent:
So it's not that the option is dynamic. It's parsed the same as any other option, it's just that the option's value has an You could do that easily with This works for all of the above examples except the first one: option("-D", "--system-prop").transformAll { all ->
all.associate { v -> v.split("=").let { it[0] to it[1] } }
}
So we could do something like There are some potential additional features that could also be added:
|
Absolutely correct, and I agree the name is misleading (and somewhat promises more than what it actually does).
That would be great!
I wonder if it makes sense to generalize
All of these would be nice to have! Omitting values is a common thing e.g. in Maven with |
Is there support for dynamic parameters in clikt, or something that comes close to it? Note that in the
-Da=b -Dc=d
example there's no space between-D
anda
, which generally is something that is not support in clikt, AFAIK.The text was updated successfully, but these errors were encountered: