Cakebrew icon indicating copy to clipboard operation
Cakebrew copied to clipboard

"Status", "Installed Version" and "Latest Version" columns as in Synaptic

Open gui-dos opened this issue 10 years ago • 6 comments

It would be nice displaying three more columns with the current status, the installed and the available version of a formula, like Synaptic.

In my personal project, Guigna, I am calling directly the Ruby interpreter with the following one-liner in order the get the name and the versions of all the available formulae:

/usr/bin/ruby -C /usr/local/Library/Homebrew -I. -e "require 'global'; require 'formula'; Formula.each {|f| puts f.name+' '+f.version}"

It is a little slow but I haven't found a simpler and faster way to get the list of the available versions of all the formulae.

gui-dos avatar May 01 '14 17:05 gui-dos

Gonna have a look at it, thanks!

brunophilipe avatar May 01 '14 18:05 brunophilipe

Fixed in https://github.com/brunophilipe/Cakebrew/commit/161eb7c0860a8a1f5df6c2af2778d2eb9e214c22 need to be closed.

maximgavrilov avatar May 02 '14 15:05 maximgavrilov

The previous one-liner was not totally correct since it ignored the revision number.

The following version appends correctly the revision number when it is > 0:

/usr/bin/ruby -C /usr/local/Library/Homebrew -I. -e "require 'global'; require 'formula'; Formula.each {|f| rev = f.revision.to_s; puts \"#{f.name} #{f.version}#{rev == '0' ? '' : \"_#{rev}\"}\"}"

It could be useful to display the "Latest Version" column also when "All formulas" is selected.

gui-dos avatar May 02 '14 16:05 gui-dos

There is a simpler version actually, thanks to pkg_version:

/usr/bin/ruby -C /usr/local/Library/Homebrew -I. -e "require 'global'; require 'formula'; Formula.each {|f| puts \"#{f.name} #{f.pkg_version}\"}"

gui-dos avatar May 06 '14 08:05 gui-dos

That's really cool. I just want to get the brew tasks and the current problems fixed and stable before creating a new front to deal with direct queries like that.

brunophilipe avatar May 06 '14 20:05 brunophilipe

Unfortunately such direct method isn't supported anymore (https://github.com/Homebrew/homebrew/pull/48261).

The recommended way to parse the detailed info of all the available formulae is to parse the JSON output of brew info --all --json=v1

gui-dos avatar Feb 05 '16 07:02 gui-dos