How do you get Cabal to print all available versions of a package?

Viewed 254

How do you get Cabal to print all available versions of a package? Running cabal -v info package-name prints something like this; in case many versions are available:

Versions available: (0.1.5.5), (0.1.5.6), (0.1.6.3), (0.1.6.4), 0.1.6.5,
                    0.2.4.2, 0.2.5.0, 0.2.6.0, 0.2.7.0 (and 26 others)
2 Answers

An indirect way to accomplish this, e.g. for the text package is

cabal list --simple-output text | awk '$1=="text" { print $2 }'

The post-processing via awk is needed because cabal list currently only supports substring matching, but not exact matching.

I don't know how to get cabal to do it, but the information is at least available. Check the Hackage page for the package; typically this is http://hackage.haskell.org/package/<package-name>. It will include a complete list of available versions right after the package description.

Related