문제

I want to be able to search for a package and get a download link as well as a list of all the dependencies. Is there an easy way to do this through the command line or a Haskell module?

도움이 되었습니까?

해결책

cabal (available from the cabal-install package, if you don't already have it) can do this. I'll shamelessly use my just-released universe package as a running example. For searching:

sorghum:~% cabal list universe
* universe
    Synopsis: Classes for types where we know all the values
    Default available version: 0.0
    Installed versions: 0.0
    License:  BSD3

* universe-th
    Synopsis: Construct a Dec's ancestor list.
    Default available version: 0.0.0.6
    Installed versions: [ Not installed ]
    Homepage: http://github.com/jfishcoff/universe-th
    License:  BSD3

For dependency information:

sorghum:~% cabal info universe
* universe         (library)
    Synopsis:      Classes for types where we know all the values
    Versions available: 0.0
    Versions installed: 0.0
    Homepage:      [ Not specified ]
    Bug reports:   [ Not specified ]
    Description:   A small package, in the spirit of data-default, which allows
                   the munging of finite and recursively enumerable types
    Category:      Data
    License:       BSD3
    Author:        Daniel Wagner
    Maintainer:    daniel@wagner-home.com
    Source repo:   [ Not specified ]
    Dependencies:  base ==4.*, void >=0.1 && <0.6
    Documentation: /home/dmwit/.cabal/x86_64/share/doc/universe-0.0/html
    Cached:        No
    Modules:
        Data.Universe
        Data.Universe.Helpers

To download and unpack:

sorghum:~% cabal unpack universe
Downloading universe-0.0...
Unpacking to universe-0.0/

You can also just download without unpacking with cabal fetch, for which you may enjoy the --no-dependencies flag (or then again maybe not).

다른 팁

AFAIK the current hackage doesn't have it. But the new one has some basic API calls. Most of them returns html, but some of them returns JSON representation.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top