Skip to content

Reinstate brew cask search #6975

@vitorgalvao

Description

@vitorgalvao

A detailed description of the proposed feature

Originated as part of the discussion in #6950.

Having flags that mimic subcommands is a poor interface—they have low discoverability and are confusing. The one command that does it is brew search, and my argument is users would be better served by reinstating brew cask search.

Let’s look at the current search situation:

brew search                    # lists all formulae
brew search <argument>         # search for <argument> in formulae and casks
brew search --casks            # lists all casks
brew search --casks <argument> # searches for <argument> in formulae and casks

So without the --casks flag, half the time you only get formulae, the other half you get formulae and casks; if you give the --casks flag, half the time you only get casks, the other half you get formulae and casks. That’s wholly unintuitive. One of the commands is useless (brew search --casks <argument>) but you wouldn’t know without trying and could be forgiven for thinking it only showed casks.

Compare that to reinstating brew cask search:

brew search                 # lists all formulae
brew search <argument>      # searches for <argument> in formulae
brew cask search            # lists all casks
brew cask search <argument> # searches for <argument> in casks

All commands do what they say all the time. We lose the ability to show both casks and formulae at once but gain clarity, which is more important. We already require two commands for every other task—like upgrade, which I’d wager is called way more often (do we have data on that?).

If having a single command to search both formulae and casks is a must, I’d recommend an --all, or --both, or --fac (formulae and casks) flag.

In essence, every command that needs the option to run on just formulae or just casks should be under their respective subcommand. update works as standalone because it deals with taps, not formulae and casks. One could also make a case for the consolidation of info (if there’s a formulae and a cask share a name, it doesn’t seem problematic that info would show both).

The motivation for the feature

Make Homebrew’s interface more consistent, thus clearer.

How the feature would be relevant to at least 90% of Homebrew users

Following the principle of least astonishment is a benefit to every user.

What alternatives to the feature have been considered

Alternative 1

Get rid of the --casks flag and make brew search always show both:

brew search            # lists all formulae and casks
brew search <argument> # search for <argument> in formulae and casks

Alternative 2

Make brew search always show both; make --casks always search only for casks; add a --formulae flag to search only for formulae. I don’t think this is a good idea, but it’s still better than the current situation:

brew search                       # lists all formulae and casks
brew search <argument>            # search for <argument> in formulae and casks
brew search --formulae            # lists all formulae
brew search --formulae <argument> # search for <argument> in formulae
brew search --casks               # lists all casks
brew search --casks <argument>.   # search for <argument> in casks

Metadata

Metadata

Assignees

No one assigned

    Labels

    outdatedPR was locked due to age

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions