summaryrefslogtreecommitdiff
path: root/docs/source/list_commands.rst
blob: 62fbebbde04c381c4bdd56a7addbb115ba30b865 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
========================
 List Output Formatters
========================

cliff-tablib delivers several new output formatters for list commands.

html
====

The ``html`` formatter uses tablib_ to produce HTML output as a table.

::

  (.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>

json
====

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}]

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