Reputation: 23135
Is there anyway, presumably using the Cabal
package, to get a list of PackageDesciption
s in the current local database?
Upvotes: 0
Views: 26
Reputation: 15959
I don't know if there's a "built-in"-way of doing this, but I've used this
ghc-pkg list | grep -v "\(^/\|^$\|(\)" | xargs cabal info | grep "\(^\*\|License\)"
to extract "License" info for all installed packages.
stack
or cabal-sandbox
- the first command needs to be replaced by either stack exec -- ghc-pkg list
or cabal sandbox hc-pkg list
./opt/ghc/8.0.2/lib/ghc-8.0.2/package.conf.d
, empty lines and lines starting with (
- somehow the colored lines produced by ghc-pkg
like ghc-8.0.2
end up with starting (
in my terminal when grepping.*
and the License
field.I hope this is what you were looking for. Another way, I think, would be writing a haskell program and use Cabal
as a library.
Upvotes: 2