CLI frontend to the Cloogle API
Python
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
.gitignore
LICENSE
README.md
clooglecli.py
requirements.txt
setup.py

README.md

cloogle-cli

cloogle-cli is a commandline frontend for the Cloogle API. At the moment, it supports the full API functionality plus some extra. This frontend talks directly to the CloogleServer as opposed to going through the PHP wrapper.

Installation

Simply run:

python setup.py install

clooglecli.py will be available in your path. This package is not yet avaliable through PyPI.

Usage

clooglecli.py [OPTIONS] <searchstring>

Some examples:

$ clooglecli.py hd

Module              Function
------------------  --------------------------------------------
StdList             hd :: ([a] -> a)
Data.Tuple          appThd3 :: ((c -> d) (a, b, c) -> (a, b, d))
StdOverloadedList   Hd :: ((l e) -> e)
Data.Map            findWithDefault :: (a k (Map k a) -> a)
Data.IntMap.Strict  findWithDefault :: (a Int (IntMap a) -> a)


$ clooglecli.py -U 'a -> String' ''

Module              Function
------------------  -------------------------------------------
genLibTest          show1 :: (a -> String)
GenPrint            printToString :: (a -> String)
Text.XML            toXMLString :: (a -> String)
Data.Serialization  serialize :: (a -> String)
Graphviz            digraphTitle :: (Digraph -> String)
...


$ clooglecli.py catMaybes -m StdMaybe

Module    Function
--------  ----------------------------------------------------------
StdMaybe  catMaybes :: ([(Maybe a)] -> [a])
StdMaybe  mapMaybe :: ((x -> y) (Maybe x) -> (Maybe y))
StdMaybe  mapMaybe :: ((x -> y) (Maybe x) -> (Maybe y))
StdMaybe  accMaybe :: ((St x a) (Maybe x) -> ((Maybe a), (Maybe x)))
StdMaybe  listToMaybe :: ([a] -> (Maybe a))

Available options

  • -u --url URL: supply a custom API URL (default: "cloogle.camilstaps.nl")
  • -p --port PORT: supply a custom API port (default: 31215)
  • -m --modules MODULE [MODULE [..]]: filters results on given module (WARNING: this is case sensitive). Note that when using this argument, argparse must have some way of deciding which values belong to it. Use last in your commands to be safe.
  • -U --unify FUNCSIG: function type to unify (e.g. a a -> Int will unify to String String -> Int)
  • -n --maxitems MAXITEMS: max number of items to display
  • -v --verbose: used to set the logger output level

cloogle-cli supports different output formats:

  • --table: tabulated output of search results
  • --minimal: minimal listing of results

Tips

Create aliases to reduce the length of commands! As an example:

alias ccls=clooglecli -n 999 -m

This allows you to easily list all functions for a certain module, or multiple:

$ ccls StdList
$ ccls StdList StdInt StdMaybe