From dac0d716c19608ad1665ff062df0208fcb26ecd1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micka=C3=ABl=20Schoentgen?= Date: Tue, 24 Aug 2021 17:11:40 +0200 Subject: [PATCH] Add the formatting options section in the docs (#1131) It will ease future changes and should improve reading/finding information. --- README.rst | 33 ++++++++++++++++++++++++++------- 1 file changed, 26 insertions(+), 7 deletions(-) diff --git a/README.rst b/README.rst index 10e8885b..e7286088 100644 --- a/README.rst +++ b/README.rst @@ -1560,24 +1560,43 @@ One of these options can be used to control output processing: 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: ++-------------------------------+---------------+------------------------------+ +| 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 sorting, and specify a custom JSON indent size: - .. code-block:: bash $ 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 -`config`_ file. See ``http --help`` for all the available formatting options. +There are also shortcuts that allow you to quickly disable and re-enable 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 -sorting-related format options (currently it means JSON keys and headers): -``--unsorted`` and ``--sorted``. +.. code-block:: bash + + $ 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