-
Notifications
You must be signed in to change notification settings - Fork 424
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
Mixin-with-prefix capability? #2310
Comments
…ixin reuse in the same command. Addresses issue remkop#2310
…ixin reuse in the same command. Addresses issue remkop#2310 # Please enter the commit message for your changes. Lines starting
@alexturc I see the PR for this feature (#2311) but to be honest I don't like the idea... Note that there is already a generic mechanism to transform the model: If that mechanism has limitations so that it cannot be used for this use case I would rather improve the existing generic mechanism rather than introduce another more narrow new mechanism. |
Hi @remkop, Mixins are a great way of grouping related options such that complex commands can be built while still being able to manage complexity. But a feature which I'm facing quite often and became a burden is inability of reuse mixins in the same command, as option names would clash. A typical example is for database connections (but I encounter multiple such situations), where a mixin would be
An application working with multiple DB connections would reuse the above class like this:
As of now this would not work as option names coming from different The goal here would be to add a prefix to option names originating from the three mixins such that we can successfully build a command line while reusing The solution int he PR keeps the mapping logic at mixin declaration, so I think it has good developer ergonomics - one can see immediately how option names are transformed. But I can work with Would this be acceptable? |
I sent another PR which uses |
Hi! Thanks for the PR!I’m currently traveling with limited access to internet. I’ll take a look when I get back. On Aug 17, 2024, at 1:08, alexturc ***@***.***> wrote:
I sent another PR which uses IModelTransformer with mixins. This alows me to make more changes actually, including prefixing the environment variables from where the default values would be taken by default. Please let me know if this acceptable.
—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you were mentioned.Message ID: ***@***.***>
|
Discussed in #1808
Originally posted by rcauble September 11, 2022
Hi,
I have a use case where I have 2 commands with each their own set of settings:
And I am trying to create a 3rd command that computes a diff of the other 2. As you can see above, though there is overlap in the options of the 2 commands and so I'm looking for a MixinWithPrefix capability so that I can do something like this:
And then this will define a new command where the user can do:
To add an additional constraint for context, Command1 and Command2 live in different libraries from the differ and so I can't simply arrange for the names to be distinct as they are not necessarily owned by me.
Any suggestions?
The text was updated successfully, but these errors were encountered: