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
Add brew link --HEAD
#11397
Add brew link --HEAD
#11397
Conversation
|
Nice work again so far @cnnrmnn!
Yes, you can have multiple non-head kegs installed 😭. Let me know if you need a hand with how to progress. |
Do you know why |
My guess is just it's pluralised like |
Co-authored-by: Mike McQuaid <mike@mikemcquaid.com>
It was called |
The code doesn't work in its current state. Main issue is that
Why do both |
I think this is desirable 👍🏻
I think this would be OK, actually, we could output a message staging that
|
Another strange behavior I noticed is that installing the Also, if there are multiple non- |
|
I think the main question here is if the link in
I think the answer should ideally address this. Perhaps a version flag should be added to |
Library/Homebrew/cli/named_args.rb
Outdated
@@ -98,8 +98,8 @@ def load_formula_or_cask(name, only: nil, method: nil) | |||
Formulary.factory(name, *spec, force_bottle: @force_bottle, flags: @flags) | |||
when :resolve | |||
resolve_formula(name) | |||
when :keg | |||
resolve_keg(name) | |||
when :default_kegs |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@MikeMcQuaid is this going to be a backward-incompatible change? It looks like Homebrew::CLI::NamedArgs
is in the private API but Homebrew::CLI::Args#named
is a public method that returns a NamedArgs
array. I wonder, then, if the @api private
label here is incorrect.
In fact, I realized that I'm using args.named.to_formulae
in a few taps, not realizing it wasn't a public method.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is. Ideally we'd allow but deprecate (on the next minor version e.g. add a commented out # odeprecated
) the existing naming.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@MikeMcQuaid should the @api
level be changed?
I don't know if there's a reason for this but I can't think of one off the top of my head. It seems to me that what a user would expect when installing is that whatever version they've most recently installed is the one that's linked. I don't see why installing a stable version shouldn't wipe the
In what situation are there two versions installed, other than a |
I can't think of any off of the top of my head, but @MikeMcQuaid mentioned earlier in this PR that it is possible to have multiple non-
|
I guess my thinking is that even if it's possible for there to be multiple we don't need to support doing anything with the non-(head-or-latest-version) keg. So I think just autodetecting the latest version is the way to go; no need to add any new flags. Same goes for Let's hear from Mike and see if he has a different opinion. |
Co-authored-by: Rylan Polster <rslpolster@gmail.com>
Co-authored-by: Rylan Polster <rslpolster@gmail.com>
My recent changes make |
Co-authored-by: Mike McQuaid <mike@mikemcquaid.com>
Co-authored-by: Mike McQuaid <mike@mikemcquaid.com>
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just one suggestion and then I think this will be good
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me!
Thanks again for the great work, @cnnrmnn!
brew style
with your changes locally?brew typecheck
with your changes locally?brew tests
with your changes locally?Closes #11224.
Currently, if the
head
andstable
versions of a formula are both installed, it isn't possible to link thehead
version of the formula. This PR adds the--HEAD
flag to link thehead
version of a formula.I had to revise the link command to use
to_formulae_and_casks(only: :formula, method: :kegs)
rather thanto_kegs
(which callsto_formulae_and_casks(only: :formula, method: :keg)
to get both thehead
andstable
kegs. I may have inadvertently created an issue if multiple non-head kegs can be installed. My modifications make thelink
command attempt to link any non-head kegs unless--HEAD
is given.I would appreciate it if a maintainer weighed in on this.