Implement a yaml formatter in cliff
This change replaces the cliff-tablib yaml formatter with an internal replacement. It differs from the tablib formatter in the following ways: - always outputs with block formatting rather than the PyYAML default of deciding based on value content - emit_one serialises a simple dict where the column name is the key and the data item is the value (rather than a list of dicts with 'Field' and 'Value' keys) - emit_one preserves column order by printing a single-item dict for each column_name The cliff release which contains this change will need a corresponding cliff-tablib release which removes the yaml formatter from its setup.py entry_points. Change-Id: I691dbab3dee7c5ec28b1083f87ab1f5c051d582b Related-Bug: #1308744
This commit is contained in:
@@ -90,10 +90,34 @@ a script.
|
||||
Makefile is 5569 bytes
|
||||
source is 408 bytes
|
||||
|
||||
yaml
|
||||
----
|
||||
|
||||
The ``yaml`` formatter uses PyYAML_ to produce a YAML sequence of
|
||||
mappings.
|
||||
|
||||
.. _PyYAML: http://pyyaml.org/
|
||||
|
||||
::
|
||||
|
||||
(.venv)$ cliffdemo files -f yaml
|
||||
- Name: dist
|
||||
Size: 4096
|
||||
- Name: cliffdemo.egg-info
|
||||
Size: 4096
|
||||
- Name: README.rst
|
||||
Size: 960
|
||||
- Name: setup.py
|
||||
Size: 1807
|
||||
- Name: build
|
||||
Size: 4096
|
||||
- Name: cliffdemo
|
||||
Size: 4096
|
||||
|
||||
Other Formatters
|
||||
----------------
|
||||
|
||||
Formatters using tablib_ to produce JSON, YAML, and HTML are available
|
||||
Formatters using tablib_ to produce JSON and HTML are available
|
||||
as part of `cliff-tablib`_.
|
||||
|
||||
.. _cliff-tablib: https://github.com/dreamhost/cliff-tablib
|
||||
|
||||
@@ -83,10 +83,27 @@ value of the field or fields.
|
||||
(.venv)$ echo $SIZE
|
||||
5916
|
||||
|
||||
yaml
|
||||
----
|
||||
|
||||
The ``yaml`` formatter uses PyYAML_ to produce a YAML mapping where
|
||||
the field name is the key.
|
||||
|
||||
.. _PyYAML: http://pyyaml.org/
|
||||
|
||||
::
|
||||
|
||||
(.venv)$ cliffdemo file -f yaml setup.py
|
||||
Name: setup.py
|
||||
Size: 1807
|
||||
UID: 1000
|
||||
GID: 1000
|
||||
Modified Time: 1393531476.9587486
|
||||
|
||||
Other Formatters
|
||||
----------------
|
||||
|
||||
Formatters using tablib_ to produce JSON, YAML, and HTML are available
|
||||
Formatters using tablib_ to produce JSON and HTML are available
|
||||
as part of `cliff-tablib`_.
|
||||
|
||||
.. _cliff-tablib: https://github.com/dreamhost/cliff-tablib
|
||||
|
||||
Reference in New Issue
Block a user