summaryrefslogtreecommitdiff
path: root/docs/source/show_commands.rst
blob: 661acec446bab692298b713460ad0c54c8e4e7ff (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
60
61
62
63
========================
 Show Output Formatters
========================

cliff is delivered with output formatters for show
commands. :class:`ShowOne` adds a command line switch to let the user
specify the formatter they want, so you don't have to do any extra
work in your application.

html
----

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

::

    (.venv)$ cliffdemo file -f html setup.py
    <table>
    <thead>
    <tr><th>Field</th>
    <th>Value</th></tr>
    </thead>
    <tr><td>Name</td>
    <td>setup.py</td></tr>
    <tr><td>Size</td>
    <td>6373</td></tr>
    <tr><td>UID</td>
    <td>527</td></tr>
    <tr><td>GID</td>
    <td>501</td></tr>
    <tr><td>Modified Time</td>
    <td>1336353173.0</td></tr>
    </table>

json
----

The ``json`` formatter uses tablib_ to produce JSON output.

::

    (.venv)$ cliffdemo file -f json setup.py
    [{"Field": "Name", "Value": "setup.py"}, {"Field": "Size",
    "Value": 6373}, {"Field": "UID", "Value": 527}, {"Field": "GID",
    "Value": 501}, {"Field": "Modified Time", "Value": 1336353173.0}]

yaml
----

The ``yaml`` formatter uses tablib_ to produce YAML output as a
sequence of mappings.

::

    (.venv)$ cliffdemo file -f yaml setup.py
    - {Field: Name, Value: setup.py}
    - {Field: Size, Value: 6373}
    - {Field: UID, Value: 527}
    - {Field: GID, Value: 501}
    - {Field: Modified Time, Value: 1336353173.0}


.. _tablib: https://github.com/kennethreitz/tablib