summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorDoug Hellmann <doug.hellmann@dreamhost.com>2012-05-06 20:06:17 -0400
committerDoug Hellmann <doug.hellmann@dreamhost.com>2012-05-06 20:06:17 -0400
commit6efada5b6a084e5e22e3b7a225375ff8132be255 (patch)
tree12075126f5e2bd3708ece4b1bbf995027b452320 /docs
parent2acfc3ce1e6d88a9acbd994360388927eb25c844 (diff)
downloadcliff-tablib-6efada5b6a084e5e22e3b7a225375ff8132be255.tar.gz
add yaml, json, and html formatters
Diffstat (limited to 'docs')
-rw-r--r--docs/source/list_commands.rst64
1 files changed, 60 insertions, 4 deletions
diff --git a/docs/source/list_commands.rst b/docs/source/list_commands.rst
index 2dbf748..fbca699 100644
--- a/docs/source/list_commands.rst
+++ b/docs/source/list_commands.rst
@@ -43,11 +43,23 @@ further manipulation.
"Makefile",5569
"source",408
-PrettyTable
------------
+json
+----
-The ``PrettyTable`` formatter uses PrettyTable_ to produce output
-formatted for human consumption.
+The ``json`` formatter uses tablib_ to produce JSON output.
+
+::
+
+ (.venv)$ cliffdemo files -f json
+ [{"Name": "build", "Size": 136}, {"Name": "cliffdemo.log", "Size":
+ 3461}, {"Name": "Makefile", "Size": 5569}, {"Name":
+ "requirements.txt", "Size": 33}, {"Name": "source", "Size": 782}]
+
+table
+-----
+
+The ``table`` formatter uses PrettyTable_ to produce output formatted
+for human consumption.
.. _PrettyTable: http://code.google.com/p/prettytable/
@@ -63,6 +75,50 @@ formatted for human consumption.
| source | 408 |
+---------------+------+
+yaml
+----
+
+The ``yaml`` formatter uses tablib_ to produce YAML output as a
+sequence of mappings.
+
+::
+
+ (.venv)$ cliffdemo files -f yaml
+ - {Name: build, Size: 136}
+ - {Name: cliffdemo.log, Size: 3043}
+ - {Name: Makefile, Size: 5569}
+ - {Name: requirements.txt, Size: 33}
+ - {Name: source, Size: 816}
+
+.. _tablib: https://github.com/kennethreitz/tablib
+
+
+html
+----
+
+The ``html`` formatter uses tablib_ to produce HTML output as a
+sequence of mappings.
+
+::
+
+ (.venv)$ cliffdemo files -f html
+ <table>
+ <thead>
+ <tr><th>Name</th>
+ <th>Size</th></tr>
+ </thead>
+ <tr><td>build</td>
+ <td>136</td></tr>
+ <tr><td>cliffdemo.log</td>
+ <td>3252</td></tr>
+ <tr><td>Makefile</td>
+ <td>5569</td></tr>
+ <tr><td>requirements.txt</td>
+ <td>33</td></tr>
+ <tr><td>source</td>
+ <td>782</td></tr>
+ </table>
+
Creating Your Own Formatter
---------------------------