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:
Mickaël Schoentgen 2021-08-24 17:11:40 +02:00 committed by GitHub
parent 0340f8caf5
commit dac0d716c1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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