Ticket #235 (closed enhancement: fixed)

Opened 10 months ago

Last modified 9 months ago

cabal list should also list installed packages

Reported by: duncan Assigned to:
Priority: normal Milestone:
Component: cabal-install tool Version: 1.2.3.0
Severity: normal Keywords:
Cc: Difficulty: easy (<4 hours)
GHC Version: 6.8.2 Platform:

Description

Currently cabal list foo only looks at the available packages and not at the installed ones.

The cabal list command output needs improving. It currently lists all available versions of available (but not installed) packages. That's both too much and too little info. We want to know for each matching package the installed versions and we probably do not need to know every single available version.

There are already RepoIndex and LocalIndex types for doing lookups so this task is just to format the information nicely. See the Hackage.List module in cabal-install.

For reference you might like to look at what other similar tools do. For example Gentoo's esearch utility gives us:

$ esearch xmonad
[ Results for search key : xmonad ]
[ Applications found : 2 ]

*  x11-wm/xmonad
      Latest version available: 0.5-r1
      Latest version installed: 0.5
      Size of downloaded files: [no/bad digest]
      Homepage:    http://www.xmonad.org/
      Description: A lightweight X11 window manager
      License:     BSD

*  x11-wm/xmonad-contrib
      Latest version available: 0.5-r1
      Latest version installed: [ Not Installed ]
      Size of downloaded files: [no/bad digest]
      Homepage:    http://www.xmonad.org/
      Description: Third party extentions for xmonad
      License:     BSD

Change History

03/02/08 18:12:51 changed by duncan

  • status changed from new to closed.
  • resolution set to fixed.

Thanks to Kolmodin's patches the output now looks like:

$ cabal list xmo
 * xmobar
      Latest version available: 0.8
      Homepage: http://gorgias.mine.nu/repos/xmobar/
      Category: System
      Synopsis: A Statusbar for the XMonad Window Manager
      License:  BSD3

 * xmonad
      Latest version available: 0.6
      Latest version installed: 0.6
      Category: System
      Synopsis: A lightweight X11 window manager.
      License:  BSD3

 * xmonad-contrib
      Latest version available: 0.6
      Homepage: http://xmonad.org/
      Category: System
      Synopsis: Third party extensions for xmonad
      License:  BSD3

Or just listing installed packages:

$ cabal list xmo --installed 
 * xmonad
      Latest version available: 0.6
      Latest version installed: 0.6
      Category: System
      Synopsis: A lightweight X11 window manager.
      License:  BSD3

And the machine readable output:

$ cabal list xmo --simple-output 
xmobar 0.3
xmobar 0.3.1
xmobar 0.4
xmobar 0.5
xmobar 0.6
xmobar 0.7
xmobar 0.8
xmonad 0.1
xmonad 0.2
xmonad 0.3
xmonad 0.4
xmonad 0.4.1
xmonad 0.5
xmonad 0.6
xmonad-contrib 0.5
xmonad-contrib 0.6
$ cabal list xmo --simple-output --installed 
xmonad 0.5
xmonad 0.6