pypa/pip — pull request #1127 by rafaelcaricio (2013-08-10 17:10:41+00:00)
Title: Add JSON and CSV output types for pip list command

Following the feedback made on #797 I've decided to work in a completely new implementation for output formats in pip list command. Now it's implemented in a more general way which makes easy to extend to other commands (like show or freeze).

Generation of CSV output:
```shell
$ pip list --output=csv
Package,Version,Location
git-remote-helpers,0.1.0,
mock,1.0.1,
nose,1.3.0,
pip,1.5.dev1,/Users/rafaelcaricio/development/pip
py,1.4.15,
ScriptTest,1.2,
setuptools,0.6c11,
tox,1.5.0,
virtualenv,1.10.1,
wsgiref,0.1.2,
```

And JSON for the same data (I used a separated [command line tool](https://github.com/jmhodges/jsonpp) for formatting the json result):
```shell
$ pip list --output=json | jsonpp
[
{
"version": "0.1.0",
"location": null,
"package": "git-remote-helpers"
},
{
"version": "1.0.1",
"location": null,
"package": "mock"
},
{
"version": "1.3.0",
"location": null,
"package": "nose"
},
{
"version": "1.5.dev1",
"location": "/Users/rafaelcaricio/development/pip",
"package": "pip"
},
{
"version": "1.4.15",
"location": null,
"package": "py"
},
{
"version": "1.2",
"location": null,
"package": "ScriptTest"
},
{
"version": "0.6c11",
"location": null,
"package": "setuptools"
},
{
"version": "1.5.0",
"location": null,
"package": "tox"
},
{
"version": "1.10.1",
"location": null,
"package": "virtualenv"
},
{
"version": "0.1.2",
"location": null,
"package": "wsgiref"
}
]
```