-
Notifications
You must be signed in to change notification settings - Fork 859
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
Request: Allow --output-file, --annotation-style, etc. multiple times, only use right-most #3248
Comments
I think I'd find this behavior really confusing. What if we provided a |
A file-based configuration or global configuration would not work for my case, which is functions that have their own defaults but are separate from any other ways the user wishes to use pip or uv. With FWIW, this is a very common convention (later options "win"), and is used not just by pip-tools but also pip itself. For example, the following command only uses the $ pip install --cache-dir="$PWD/cache1" requests --cache-dir="$PWD/cache2" |
I think you'd just write a simple bash function instead of an alias that sets a default value for the variable before calling into
I think with something like |
FWIW here's maybe a more analogous option from pip: $ pip install --dry-run --quiet --report=out1.json requests --report=out2.json As expected, only |
Similarly, both busybox |
I'll note that I am having similar troubles with e.g. |
I suspect part of this comes from argparse's design. Many python libraries use argparse/similar library. argparse's default behavior is last one wins with no awareness of meaning flag. edit: Personally I like current duplicates are hard error over last one wins. My guess is it's commonness in python ecosystem is less that clis made choice individually, but argument handling libraries default choices made it common. |
Is this the same? clap-rs/clap#4261 |
Yeah, looks like exactly that. |
I think you can set this globally with something like https://docs.rs/clap/latest/clap/struct.Command.html#method.args_override_self. |
I probably should have posted these questions here instead of #3259: Would either of the following make this change more palatable to those against it?
|
If this change is more likely to happen limited to a certain subset of flags, I'll list here the ones I most wish to override later (most likely to break usage of my project when subbing uv for pip-tools, though not at all exhaustive):
|
Is there any form of this that has been suggested, or that you can come up with, which you're willing to allow? |
I don't think adding this to a subset of options would be great — consistency across the CLI seems important. I do find your ecosystem examples convincing, but I still worry about the possibility of confusion. I'm just not seeing enough interest to merit changing this right now. (We have many issues with upvotes but nobody else has asked for this change yet) |
I expect it's just a matter of time, as my project was relatively quick to adopt and adapt to uv, so I hold out hope that this will change eventually. In the meantime I'll add one more widely used example: $ alias gd="git diff --submodule=log"
$ gd --submodule=diff # this works, as expected |
requirements.in
:I'm requesting that instead, the above command write output to (only)
reqs2.txt
, the latest instance of-o
/--output-file
on the command line. This is useful when using shell aliases or functions to wrapuv
, when you specify a "default" output file in the alias or function, while allowing any invocation to easily override that default by specifying the option again, on the command line.That's how pip-tools behaves, and I make use of that behavior.
The text was updated successfully, but these errors were encountered: