docs: update scripting documentation

This commit is contained in:
Michael Terry 2024-08-03 16:20:56 -04:00
parent 6283915f86
commit d3f9c05312

View file

@ -83,12 +83,33 @@ JSON output of most restic commands are documented here.
list of allowed values is documented may be extended at any time.
Exit errors
-----------
Fatal errors will result in a final JSON message on ``stderr`` before the process exits.
It will hold the error message and the exit code.
.. note::
Some errors cannot be caught and reported this way,
such as Go runtime errors or command line parsing errors.
+----------------------+-------------------------------------------+
| ``message_type`` | Always "exit_error" |
+----------------------+-------------------------------------------+
| ``code`` | Exit code (see above chart) |
+----------------------+-------------------------------------------+
| ``error`` | Error message |
+----------------------+-------------------------------------------+
Output formats
--------------
Currently only the output on ``stdout`` is JSON formatted. Errors printed on ``stderr``
are still printed as plain text messages. The generated JSON output uses one of the
following two formats.
Commands print their main JSON output on ``stdout``.
The generated JSON output uses one of the following two formats.
.. note::
Not all messages and errors have been converted to JSON yet.
Feel free to submit a pull request!
Single JSON document
^^^^^^^^^^^^^^^^^^^^
@ -136,6 +157,8 @@ Status
Error
^^^^^
These errors are printed on ``stderr``.
+----------------------+-------------------------------------------+
| ``message_type`` | Always "error" |
+----------------------+-------------------------------------------+
@ -542,6 +565,8 @@ Status
Error
^^^^^
These errors are printed on ``stderr``.
+----------------------+-------------------------------------------+
| ``message_type`` | Always "error" |
+----------------------+-------------------------------------------+
@ -691,12 +716,14 @@ version
The version command returns a single JSON object.
+----------------+--------------------+
+------------------+--------------------+
| ``message_type`` | Always "version" |
+------------------+--------------------+
| ``version`` | restic version |
+----------------+--------------------+
+------------------+--------------------+
| ``go_version`` | Go compile version |
+----------------+--------------------+
+------------------+--------------------+
| ``go_os`` | Go OS |
+----------------+--------------------+
+------------------+--------------------+
| ``go_arch`` | Go architecture |
+----------------+--------------------+
+------------------+--------------------+