Skip to content
This repository has been archived by the owner on Mar 14, 2021. It is now read-only.

Completions no longer work for brew cask install #4

Closed
lwolfsonkin opened this issue Jun 22, 2018 · 11 comments
Closed

Completions no longer work for brew cask install #4

lwolfsonkin opened this issue Jun 22, 2018 · 11 comments

Comments

@lwolfsonkin
Copy link
Contributor

lwolfsonkin commented Jun 22, 2018

brew was updated deprecating brew cask search, causing annoying error message after every initiation of autocomplete, and the new output of brew search has a separate section for normal formulae and casks.

$ brew search fire
==> Formulae
brewsci/science/arrayfire                            firebase-cli                                         nifi-registry

==> Casks
firealpaca      firebase-admin  firebird-emu    firefox         firestormos     firestr         firetask        mediafire       multifirefox    truefire

3 things should happen:

  1. We should use brew search instead of brew cask search
  2. We should parse the output differently to get just the casks.
  3. For normal brew install we should probably update the output parsing of brew search, though it seems to work fine currently.
@laughedelic
Copy link
Owner

Hi @lwolfsonkin. Thanks for the report and analysis. I'll look into this when I have some time. Let me know if you're willing to fix it yourself.

@laughedelic
Copy link
Owner

I think this is blocked now, see Homebrew/brew#4254. brew search just doesn't output casks and I don't see a way to list casks with this change.

@peterlobster
Copy link

peterlobster commented Sep 21, 2018

@laughedelic @lwolfsonkin Considering that brew cask search is going to be deprecated in 10 days (09/30/2018), could perhaps this commit changes things?

Readd functionality to list all casks. #4372

@lwolfsonkin
Copy link
Contributor Author

@peterlobster: I think theoretically it should, but when I tried to use it, it didn't work for me:

$ brew search --casks sky
==> Formulae
darksky-weather

==> Casks
endlesssky                kinsky                    skyfonts                  skype ✔                   skype-for-business        skypewebplugin

If it were working properly, there wouldn't be formulae there.

Also for reference:

$ brew --version
Homebrew 1.7.4-58-gbde49f5
Homebrew/homebrew-core (git revision a216b; last commit 2018-09-15)
Homebrew/homebrew-cask (git revision dc49a1; last commit 2018-09-15)

Does it work for you?

@peterlobster
Copy link

peterlobster commented Sep 21, 2018

@lwolfsonkin It does...

brew search sublime --cask                                                            
==> Casks
sublime                                                                homebrew/cask-versions/sublime-text-dev
sublime-text ✔                                                         homebrew/cask-versions/sublime-text2

@laughedelic Maybe a short term solution would be just to disable the tab completion for brew cask search. You shouldn't be using that anyways. That said, maybe you could up the readme to reflect the change in Homebrew.

@lwolfsonkin
Copy link
Contributor Author

@peterlobster: I would have to disagree with you here. My understanding of the current functionality of brew search is that, unadorned, it returns formulae and casked, and when given the --casks flag, it should only return casks. You were lucky in this instance because there are no forumulae containing sublime. If you choose to search something that contains formulae and casks, such as docker:

$brew search docker
==> Formulae
docker                          docker-compose                  docker-gen                      docker-machine-driver-hyperkit  docker-machine-parallels
docker-clean                    docker-compose-completion       docker-ls                       docker-machine-driver-vultr     docker-squash
docker-cloud                    docker-credential-helper        docker-machine                  docker-machine-driver-xhyve     docker-swarm
docker-completion ✔             docker-credential-helper-ecr    docker-machine-completion       docker-machine-nfs              docker2aci

==> Casks
docker ✔                                             docker-toolbox                                       homebrew/cask-versions/docker-edge

and with the --casks flag:

$brew search --casks docker
==> Formulae
docker                          docker-compose                  docker-gen                      docker-machine-driver-hyperkit  docker-machine-parallels
docker-clean                    docker-compose-completion       docker-ls                       docker-machine-driver-vultr     docker-squash
docker-cloud                    docker-credential-helper        docker-machine                  docker-machine-driver-xhyve     docker-swarm
docker-completion ✔             docker-credential-helper-ecr    docker-machine-completion       docker-machine-nfs              docker2aci

==> Casks
docker ✔                                             docker-toolbox                                       homebrew/cask-versions/docker-edge

So, brew does not currently seem to be working according to the new description.

@lwolfsonkin
Copy link
Contributor Author

UPDATE:

Sorry, I think that I just looked at the documentation, and the documentation is confusing, but does what it says:

In the search documentation, it claims that brew search should return all local formulae, brew search --casks should return all local casks, and brew search [--desc] (<text>|/<text>/) will search online for all casks and formulae. So, essentially, if you provide a text input, regardless of whether --casks is or isn't provided, it will search casks and formulae online.

@laughedelic: I'm assuming this is in contrast to how you were parsing the output of brew cask search previously because I assume if the user typed brew cask info bl, the completion searched brew cask search bl to come up with completions. But now, you would just brew search --casks and pipe to grep bl or something along those lines.

@peterlobster
Copy link

peterlobster commented Sep 21, 2018

@lwolfsonkin You are correct.

@lwolfsonkin @laughedelic You second point in your post, is a excellent idea. The normal 'brew search `search completion function is working fine. Maybe just need to modify it a little bit. I'd offer to make the pull request to implement your idea but I really don't have time right now. I might be able to do it later (like maybe next week), if you guys don't have the time to make the changes.

@lwolfsonkin
Copy link
Contributor Author

I skimmed through the code, and it seems that the change required is a really simple one-liner. Just swap in brew search --casks. I'm not at my computer right now, but that's all the change should require.

@peterlobster
Copy link

@lwolfsonkin I'm assuming you're referring to like 195.

@laughedelic
Copy link
Owner

Hi guys, thanks for the discussion and the fix from @lwolfsonkin 👍
It seems to work as expected, although it's kind of slow (probably it was the same before), but caching could help here (see #1).

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants