Redo command-line interface.

- YAML is replaced with pretty-printed JSON
- click is used for the CLI
- The `--summary` option is now `--style=summary`
Fix bug in index parameter parsing.
Fix defaulting to stdout for output.
Make sure to close the output stream.
Merge pull request #4 from larsyencken/features/click

Redo command-line interface in click