What is the canonical way for aliasing a cask and/or making it more searchable/discoverable? #4967
Replies: 2 comments 2 replies
-
For historical context, a PR was opened based on this discussion, a bunch of back and forth discussion was had there, and the PR was ultimately closed: While there was some back and forth on the specifics of cask naming rules, this part about the search/etc aspects was particularly relevant:
|
Beta Was this translation helpful? Give feedback.
-
I would suggest that when looking for a cask for an application, that using the shortest identifying word in the application's name would be the way to go. Also, just to add some more context to the discussion, it is worth noting that Homebrew Cask does not try to be a "discovery service" - https://docs.brew.sh/Acceptable-Casks#homebrew-cask-is-not-a-discoverability-service |
Beta Was this translation helpful? Give feedback.
-
Output of
brew config
Output of
brew doctor
Description of issue
I was looking to add a new cask for Razer macOS today, as it didn't show up while I was searching; but then by some sheer luck, I stumbled upon the fact that the cask is actually called
1kc-razer
:Some history of this formula:
razer-macos
by @sgullsrazer-macos-unofficial
by @sgulls1kc-razer
by @vitorgalvaoGiven the
name
/homepage
/etc in the cask, I would have expected at least some of my searches above to have turned it up for keywordsrazer-macos
orRazer macOS
:These issues were asking about how best to support aliases for casks/etc:
homebrew-core
, not homebrew-cask:cargo
alias for therust
formula homebrew-core#36560missing_formula.rb
One of the suggestions there was the
missing_formula.rb
script:Another was using multiple
name
stanzas, but given searching by the already existingname
didn't show up the cask anyway, this doesn't seem like a good solution here (or search is broken and needs to be fixed)I'm not really familiar with the
brew
codebase, but from a quick search, this seems to be (at least some of) the code related to searching:search_descriptions
: seems like it should work for both Formulae and Caskssearch_formulae
: seems to have support for aliases? (aliases = Formula.alias_full_names
,results = search(Formula.full_names + aliases, string_or_regex).sort
). Also usesFormula.fuzzy_search
search_casks
: doesn't look like it has support for aliases, but does do some stuff related to finding all the cask tokens (cask_tokens = Tap.flat_map(&:cask_tokens).map
,Homebrew::API::Cask.all_casks.keys
,cask_tokens |= Homebrew::API::Cask.all_casks.keys
,results = search(cask_tokens, string_or_regex)
), and also seems to have some 'did you mean' suggestions (results += DidYouMean::SpellChecker.new(dictionary: cask_tokens).correct(string_or_regex))
)search_names
: this function exists, and seems like it should work for both Formulae and Casks, but at least as far as I can tell, it doesn't seem to be called anywhere in this file. It is however called from the following:--desc
flag is passed:--eval-all
to be passed as well for it to be usable at all:So combining all of the intricacies of the above custom search params, I can actually find the cask with my 'more canonical' search terms. Though I suspect that most standard users aren't going to think/know to do that:
Interesting also, searching with those flags gives me less suggestions than searching without (note the
raze
cask in the 2nd command output that is missing from the first):Which would seem to suggest that this method of searching isn't ideal as a 'default replacement' either.
I also stumbled across the
--pull-requests
flag for searching, which provides some more insight:⇒ brew search --pull-request razer macos ==> Closed pull requests 1kc-razer: migrate from cask-drivers (https://github.com/Homebrew/homebrew-cask/pull/146687) 📦 Add Razer macOS (https://github.com/Homebrew/homebrew-cask/pull/105414) Add Razer macOS (https://github.com/Homebrew/homebrew-cask-drivers/pull/2032) razer-synapse: Update website URL (https://github.com/Homebrew/homebrew-cask-drivers/pull/1435)
This shows the
razer-synapse
cask that used to exist onhomebrew-cask-drivers
, and this cask existing is possibly the reason that the1kc-
prefix was originally added to this cask:homebrew-cask-drivers
: Migrate 11 Casks to drivers homebrew-cask-drivers#41Looking at the last version of this Cask before it was removed:
We can see that it links through to the Razer website, and only supports
Mac OS X 10.10 - 10.14
, so it no longer supports modern macs (and is probably why it was never migrated back tohomebrew-cask
:Given that this conflict was probably the original reasoning for the
1kc-
prefix on the main Cask, I wonder if it can now be renamed back to something likerazer-macos
orrazer-macos-unofficial
.Reference was also made to the token reference used for naming casks:
By my read of those rules, I think
razer-macos
would be an ok name, as the app isn't really 'ported' as much as being it's own standalone thing:Even if the
-macos
suffix isn't ok based on the above rule, then it would becomerazer
, which would then move to the 'special affixes' rules for a 'potentially misleading name':Looking at the more specific rules for prefixes:
It sounds like maybe this part was applied in prefixing it with
1kc-
:But to my knowledge, this isn't a fork, and so it's confusing having it prefixed by the vendor.
While the following docs are for Formula rather than Casks, I figured I'd include it here as the current cask doesn't feel like it is named 'like the project markets the product':
I also noticed that
homebrew-cask
has acask_renames.json
, and while it might violate the rules for that usage, I wonder if adding it there would serve as an 'alias':This PR is very loosely tangentially related, but including here as a reference in case it's helpful:
Beta Was this translation helpful? Give feedback.
All reactions