brew update and can still reproduce the problem?brew doctor, fixed all issues and can still reproduce the problem?brew config and brew doctor and included their output with your issue?Understand what brew list does, now that brew cask list is deprecated.
Running brew list only displays formulae, which duplicates --formulae flag.
Brew list should either return both casks and formulae, or the description of the command should be clarified to explain that it return formulae only by default (either in the description itself or in the description of the --formulae flag).
Related: does brew upgrade upgrade both casks and formulae by default?
brew commands)brew list
brew config and brew doctor commands - NAThanks for the issue - the behaviour does seem to be inconsistent with the description text!
Related: does
brew upgradeupgrade both casks and formulae by default?
Yes, it does.
Related discussions: https://github.com/Homebrew/brew/issues/8405 and https://github.com/Homebrew/homebrew-cask/pull/88682
Looks like it's intentional for brew list to return brew list --formula, for backwards compatibility.
--formula flag description to end with This is the default action.? Should that part be in bold? Happy to open a PR.brew list [cask] won't work, and that instead you should use brew list --cask [cask]. Thoughts on updating --cask flag description:List only casks, or [cask] if provided.
(Text in brackets would be underlined).
Looks like it's intentional for brew list to return brew list --formula, for backwards compatibility.
- Thoughts on updating the
--formulaflag description to end withThis is the default action.? Should that part be in bold? Happy to open a PR.
If its the default option, is there a reason for it to be listed at all? When would --formula ever be passed? I'd remove it if there are no use cases.
- Another thing that could be made more clear is that
brew list [cask]won't work, and that instead you should usebrew list --cask [cask]. Thoughts on updating--caskflag description:
Any reason why it shouldn't work by default?
In my mind, the way it should work is as follows:
brew list lists all formulae and casks that are installedbrew list --formulae (or brew list --only-formulae) lists only formulae that are installedbrew list --casks (or brew list --only-casks) lists only casks that are installedbrew list X will list the paths associated with both the formula X and the cask Xbrew list --formula X will list the paths associated with only the formula Xbrew list --cask X will list the paths associated with only the cask XIt's possible that there's a reason for this that I don't know about. If so, please share.
brew listlists all formulae and casks that are installed
This will break backwards compatibility (which we don't want to do).
When would
--formulaever be passed?
To be explicit and allow for potential change in future. Also because other commands accept --formula.
Hey all - any interest in my suggestions? Or should I close this issue? Thanks!
@JBallin Sorry, yes, both of those sound good 馃憤馃徎
This will break backwards compatibility (which we don't want to do).
We could show both with brew list when on a TTY and print a warning when not on a TTY to switch to passing --formulae explicitly so we can eventually change the non-TTY behaviour to include both as well.
We could show both with
brew listwhen on a TTY and print a warning when not on a TTY to switch to passing--formulaeexplicitly so we can eventually change the non-TTY behaviour to include both as well.
Yeh, this is a good idea.
I can try to take a stab at this feature when I have bandwidth - but I can't guarantee a quick turnaround. Open to others contributing the change.
At this line: https://github.com/Homebrew/brew/blob/5133b4cf89b0acc6d06d9eea1eaea2ceaed11441/Library/Homebrew/cmd/list.rb#L89
Should it be something like this?
if !$stdout.tty? && !args.formula?
puts "Explicitly passed --formula"
safe_system "ls", *ls_args, HOMEBREW_CELLAR
else
safe_system "ls", *ls_args, HOMEBREW_CELLAR
ls_args.delete "-1"
if !args.formula? and ls_args.length == 0
print list_casks(args: args)
end
end
@Akylzhan, something like that, yeah. Just push it to your PR, it's easier to review that way.
This was fixed.
Most helpful comment
We could show both with
brew listwhen on a TTY and print a warning when not on a TTY to switch to passing--formulaeexplicitly so we can eventually change the non-TTY behaviour to include both as well.