docs: update scripting documentation
This commit is contained in:
parent
6283915f86
commit
d3f9c05312
1 changed files with 39 additions and 12 deletions
|
@ -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.
|
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
|
Output formats
|
||||||
--------------
|
--------------
|
||||||
|
|
||||||
Currently only the output on ``stdout`` is JSON formatted. Errors printed on ``stderr``
|
Commands print their main JSON output on ``stdout``.
|
||||||
are still printed as plain text messages. The generated JSON output uses one of the
|
The generated JSON output uses one of the following two formats.
|
||||||
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
|
Single JSON document
|
||||||
^^^^^^^^^^^^^^^^^^^^
|
^^^^^^^^^^^^^^^^^^^^
|
||||||
|
@ -136,6 +157,8 @@ Status
|
||||||
Error
|
Error
|
||||||
^^^^^
|
^^^^^
|
||||||
|
|
||||||
|
These errors are printed on ``stderr``.
|
||||||
|
|
||||||
+----------------------+-------------------------------------------+
|
+----------------------+-------------------------------------------+
|
||||||
| ``message_type`` | Always "error" |
|
| ``message_type`` | Always "error" |
|
||||||
+----------------------+-------------------------------------------+
|
+----------------------+-------------------------------------------+
|
||||||
|
@ -542,6 +565,8 @@ Status
|
||||||
Error
|
Error
|
||||||
^^^^^
|
^^^^^
|
||||||
|
|
||||||
|
These errors are printed on ``stderr``.
|
||||||
|
|
||||||
+----------------------+-------------------------------------------+
|
+----------------------+-------------------------------------------+
|
||||||
| ``message_type`` | Always "error" |
|
| ``message_type`` | Always "error" |
|
||||||
+----------------------+-------------------------------------------+
|
+----------------------+-------------------------------------------+
|
||||||
|
@ -691,12 +716,14 @@ version
|
||||||
|
|
||||||
The version command returns a single JSON object.
|
The version command returns a single JSON object.
|
||||||
|
|
||||||
+----------------+--------------------+
|
+------------------+--------------------+
|
||||||
| ``version`` | restic version |
|
| ``message_type`` | Always "version" |
|
||||||
+----------------+--------------------+
|
+------------------+--------------------+
|
||||||
| ``go_version`` | Go compile version |
|
| ``version`` | restic version |
|
||||||
+----------------+--------------------+
|
+------------------+--------------------+
|
||||||
| ``go_os`` | Go OS |
|
| ``go_version`` | Go compile version |
|
||||||
+----------------+--------------------+
|
+------------------+--------------------+
|
||||||
| ``go_arch`` | Go architecture |
|
| ``go_os`` | Go OS |
|
||||||
+----------------+--------------------+
|
+------------------+--------------------+
|
||||||
|
| ``go_arch`` | Go architecture |
|
||||||
|
+------------------+--------------------+
|
||||||
|
|
Loading…
Reference in a new issue