mirror of
https://github.com/httpie/cli.git
synced 2024-11-29 03:03:44 +01:00
Add the formatting options section in the docs (#1131)
It will ease future changes and should improve reading/finding information.
This commit is contained in:
parent
0340f8caf5
commit
dac0d716c1
33
README.rst
33
README.rst
@ -1560,24 +1560,43 @@ One of these options can be used to control output processing:
|
|||||||
Default for redirected output.
|
Default for redirected output.
|
||||||
==================== ========================================================
|
==================== ========================================================
|
||||||
|
|
||||||
|
You can control the applied formatting via the `formatting options`_.
|
||||||
|
|
||||||
|
|
||||||
|
Formatting options
|
||||||
|
------------------
|
||||||
|
|
||||||
You can control the applied formatting via the ``--format-options`` option.
|
|
||||||
The following options are available:
|
The following options are available:
|
||||||
|
|
||||||
|
+-------------------------------+---------------+------------------------------+
|
||||||
|
| Option | Default value | Shortcut(s) |
|
||||||
|
+===============================+===============+==============================+
|
||||||
|
| ``headers.sort`` | ``true`` | ``--sorted``, ``--unsorted`` |
|
||||||
|
+-------------------------------+---------------+------------------------------+
|
||||||
|
| ``json.format`` | ``true`` | N/A |
|
||||||
|
+-------------------------------+---------------+------------------------------+
|
||||||
|
| ``json.indent`` | ``4`` | N/A |
|
||||||
|
+--------------------+----------+---------------+------------------------------+
|
||||||
|
| ``json.sort_keys`` | ``true`` | ``--sorted``, ``--unsorted`` |
|
||||||
|
+--------------------+----------+---------------+------------------------------+
|
||||||
|
|
||||||
For example, this is how you would disable the default header and JSON key
|
For example, this is how you would disable the default header and JSON key
|
||||||
sorting, and specify a custom JSON indent size:
|
sorting, and specify a custom JSON indent size:
|
||||||
|
|
||||||
|
|
||||||
.. code-block:: bash
|
.. code-block:: bash
|
||||||
|
|
||||||
$ http --format-options headers.sort:false,json.sort_keys:false,json.indent:2 pie.dev/get
|
$ http --format-options headers.sort:false,json.sort_keys:false,json.indent:2 pie.dev/get
|
||||||
|
|
||||||
This is something you will typically store as one of the default options in your
|
There are also shortcuts that allow you to quickly disable and re-enable options.
|
||||||
`config`_ file. See ``http --help`` for all the available formatting options.
|
For example, ``--sorted`` and ``--unsorted`` arguments would respectively enable
|
||||||
|
and disable sorting-related format options:
|
||||||
|
|
||||||
There are also two shortcuts that allow you to quickly disable and re-enable
|
.. code-block:: bash
|
||||||
sorting-related format options (currently it means JSON keys and headers):
|
|
||||||
``--unsorted`` and ``--sorted``.
|
$ http --sorted pie.dev/get
|
||||||
|
$ http --unsorted pie.dev/get
|
||||||
|
|
||||||
|
This is something you will typically store as one of the default options in your `config`_ file.
|
||||||
|
|
||||||
|
|
||||||
Binary data
|
Binary data
|
||||||
|
Loading…
Reference in New Issue
Block a user