annotate doc/libervia-cli/debug.rst @ 4326:5fd6a4dc2122

cli (output/std): use `rich` to output JSON.
author Goffi <goffi@goffi.org>
date Wed, 20 Nov 2024 11:38:44 +0100
parents 524856bd7b19
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
3041
72583524cfd3 doc (jp): jp commands are now fully documented:
Goffi <goffi@goffi.org>
parents:
diff changeset
1 =====================================================
3505
4705f80b6e23 doc: more renaming
Goffi <goffi@goffi.org>
parents: 3488
diff changeset
2 debug: tools to help debugging/monitoring Libervia
3041
72583524cfd3 doc (jp): jp commands are now fully documented:
Goffi <goffi@goffi.org>
parents:
diff changeset
3 =====================================================
72583524cfd3 doc (jp): jp commands are now fully documented:
Goffi <goffi@goffi.org>
parents:
diff changeset
4
3563
267e4987b58b doc: fix remaining SàT references/typos + add `libervia-cli` missing commands
Goffi <goffi@goffi.org>
parents: 3536
diff changeset
5 ``debug`` groups commands to monitor or manipulate Libervia and XMPP stream.
3041
72583524cfd3 doc (jp): jp commands are now fully documented:
Goffi <goffi@goffi.org>
parents:
diff changeset
6
3683
a1eff4e32848 doc (components): base documentation for AP Gateway:
Goffi <goffi@goffi.org>
parents: 3563
diff changeset
7 .. _li_debug_bridge_method:
3041
72583524cfd3 doc (jp): jp commands are now fully documented:
Goffi <goffi@goffi.org>
parents:
diff changeset
8
72583524cfd3 doc (jp): jp commands are now fully documented:
Goffi <goffi@goffi.org>
parents:
diff changeset
9 bridge method
72583524cfd3 doc (jp): jp commands are now fully documented:
Goffi <goffi@goffi.org>
parents:
diff changeset
10 =============
72583524cfd3 doc (jp): jp commands are now fully documented:
Goffi <goffi@goffi.org>
parents:
diff changeset
11
72583524cfd3 doc (jp): jp commands are now fully documented:
Goffi <goffi@goffi.org>
parents:
diff changeset
12 Call a method of the bridge. You have to provide the name of the method and the arguments
72583524cfd3 doc (jp): jp commands are now fully documented:
Goffi <goffi@goffi.org>
parents:
diff changeset
13 as positional arguments. Arguments are evaluated as Python code (using ``eval``), so you
72583524cfd3 doc (jp): jp commands are now fully documented:
Goffi <goffi@goffi.org>
parents:
diff changeset
14 need to properly escape them (for your shell **and** Python). You can either split your
72583524cfd3 doc (jp): jp commands are now fully documented:
Goffi <goffi@goffi.org>
parents:
diff changeset
15 Python arguments as many shell arguments, or put them in a single shell argument.
72583524cfd3 doc (jp): jp commands are now fully documented:
Goffi <goffi@goffi.org>
parents:
diff changeset
16
72583524cfd3 doc (jp): jp commands are now fully documented:
Goffi <goffi@goffi.org>
parents:
diff changeset
17 You profile is automatically set if the method requires it (using the value of ``-p
72583524cfd3 doc (jp): jp commands are now fully documented:
Goffi <goffi@goffi.org>
parents:
diff changeset
18 PROFILE, --profile PROFILE``), so you must not specify it as an extra argument.
72583524cfd3 doc (jp): jp commands are now fully documented:
Goffi <goffi@goffi.org>
parents:
diff changeset
19
4037
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3683
diff changeset
20 You can refer to `bridge API documentation`_ to get core methods signatures
3041
72583524cfd3 doc (jp): jp commands are now fully documented:
Goffi <goffi@goffi.org>
parents:
diff changeset
21
72583524cfd3 doc (jp): jp commands are now fully documented:
Goffi <goffi@goffi.org>
parents:
diff changeset
22 .. _Bridge API documentation: https://wiki.goffi.org/wiki/Bridge_API
72583524cfd3 doc (jp): jp commands are now fully documented:
Goffi <goffi@goffi.org>
parents:
diff changeset
23
72583524cfd3 doc (jp): jp commands are now fully documented:
Goffi <goffi@goffi.org>
parents:
diff changeset
24
72583524cfd3 doc (jp): jp commands are now fully documented:
Goffi <goffi@goffi.org>
parents:
diff changeset
25 examples
72583524cfd3 doc (jp): jp commands are now fully documented:
Goffi <goffi@goffi.org>
parents:
diff changeset
26 --------
72583524cfd3 doc (jp): jp commands are now fully documented:
Goffi <goffi@goffi.org>
parents:
diff changeset
27
72583524cfd3 doc (jp): jp commands are now fully documented:
Goffi <goffi@goffi.org>
parents:
diff changeset
28 Send a message using a single shell arguments for all Python arguments. We
4037
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3683
diff changeset
29 use first the method name (``message_send``), then the required arguments (see `bridge
3041
72583524cfd3 doc (jp): jp commands are now fully documented:
Goffi <goffi@goffi.org>
parents:
diff changeset
30 API documentation`_ for details), without the profile as it is automatically set. We
72583524cfd3 doc (jp): jp commands are now fully documented:
Goffi <goffi@goffi.org>
parents:
diff changeset
31 specify them as Python in one shell argument, so we use single quote (``\```)first for
72583524cfd3 doc (jp): jp commands are now fully documented:
Goffi <goffi@goffi.org>
parents:
diff changeset
32 s hell string, and inside it we use double quote (``"``) for Python strings::
72583524cfd3 doc (jp): jp commands are now fully documented:
Goffi <goffi@goffi.org>
parents:
diff changeset
33
4037
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3683
diff changeset
34 $ li debug bridge method message_send '"louise@example.org", {"": "test message"}, {}, "auto", {}'
3041
72583524cfd3 doc (jp): jp commands are now fully documented:
Goffi <goffi@goffi.org>
parents:
diff changeset
35
72583524cfd3 doc (jp): jp commands are now fully documented:
Goffi <goffi@goffi.org>
parents:
diff changeset
36 .. note::
72583524cfd3 doc (jp): jp commands are now fully documented:
Goffi <goffi@goffi.org>
parents:
diff changeset
37
3488
c80a0f864b5d doc: updated doc following global renaming
Goffi <goffi@goffi.org>
parents: 3047
diff changeset
38 This is for debugging only, if you want to send message with li, use :ref:`libervia-cli_message_send`.
3041
72583524cfd3 doc (jp): jp commands are now fully documented:
Goffi <goffi@goffi.org>
parents:
diff changeset
39
3563
267e4987b58b doc: fix remaining SàT references/typos + add `libervia-cli` missing commands
Goffi <goffi@goffi.org>
parents: 3536
diff changeset
40 Get version string of Libervia::
3041
72583524cfd3 doc (jp): jp commands are now fully documented:
Goffi <goffi@goffi.org>
parents:
diff changeset
41
4037
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3683
diff changeset
42 $ li debug bridge method version_get
3041
72583524cfd3 doc (jp): jp commands are now fully documented:
Goffi <goffi@goffi.org>
parents:
diff changeset
43
72583524cfd3 doc (jp): jp commands are now fully documented:
Goffi <goffi@goffi.org>
parents:
diff changeset
44
72583524cfd3 doc (jp): jp commands are now fully documented:
Goffi <goffi@goffi.org>
parents:
diff changeset
45 bridge signal
72583524cfd3 doc (jp): jp commands are now fully documented:
Goffi <goffi@goffi.org>
parents:
diff changeset
46 =============
72583524cfd3 doc (jp): jp commands are now fully documented:
Goffi <goffi@goffi.org>
parents:
diff changeset
47
72583524cfd3 doc (jp): jp commands are now fully documented:
Goffi <goffi@goffi.org>
parents:
diff changeset
48 Send a fake signal. This is specially useful to test behaviour of a frontend when a
72583524cfd3 doc (jp): jp commands are now fully documented:
Goffi <goffi@goffi.org>
parents:
diff changeset
49 specific event happens. To use is you just need to specify the name of the signal and the
3488
c80a0f864b5d doc: updated doc following global renaming
Goffi <goffi@goffi.org>
parents: 3047
diff changeset
50 arguments to use (using Python eval in the same way as for libervia-cli_debug_bridge_method_).
3041
72583524cfd3 doc (jp): jp commands are now fully documented:
Goffi <goffi@goffi.org>
parents:
diff changeset
51
72583524cfd3 doc (jp): jp commands are now fully documented:
Goffi <goffi@goffi.org>
parents:
diff changeset
52 example
72583524cfd3 doc (jp): jp commands are now fully documented:
Goffi <goffi@goffi.org>
parents:
diff changeset
53 -------
72583524cfd3 doc (jp): jp commands are now fully documented:
Goffi <goffi@goffi.org>
parents:
diff changeset
54
72583524cfd3 doc (jp): jp commands are now fully documented:
Goffi <goffi@goffi.org>
parents:
diff changeset
55 Send a note with ``info`` level and hand written XMLUI. Here me use a shell variable to
72583524cfd3 doc (jp): jp commands are now fully documented:
Goffi <goffi@goffi.org>
parents:
diff changeset
56 store the level, so we can easily change it if we want to use an other level for tests.
72583524cfd3 doc (jp): jp commands are now fully documented:
Goffi <goffi@goffi.org>
parents:
diff changeset
57 Note the use of quotes (to escape both for shell and Python)::
72583524cfd3 doc (jp): jp commands are now fully documented:
Goffi <goffi@goffi.org>
parents:
diff changeset
58
4037
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3683
diff changeset
59 $ LEVEL='info'; li debug bridge signal -c action_new '{"xmlui": '"'"'<?xml version="1.0" ?><sat_xmlui title="test title" type="dialog"><dialog level="'$LEVEL'" type="note"><message>test message\non\nseveral\nlines</message></dialog></sat_xmlui>'"'"'}' '""' -1
3041
72583524cfd3 doc (jp): jp commands are now fully documented:
Goffi <goffi@goffi.org>
parents:
diff changeset
60
72583524cfd3 doc (jp): jp commands are now fully documented:
Goffi <goffi@goffi.org>
parents:
diff changeset
61
72583524cfd3 doc (jp): jp commands are now fully documented:
Goffi <goffi@goffi.org>
parents:
diff changeset
62 monitor
72583524cfd3 doc (jp): jp commands are now fully documented:
Goffi <goffi@goffi.org>
parents:
diff changeset
63 =======
72583524cfd3 doc (jp): jp commands are now fully documented:
Goffi <goffi@goffi.org>
parents:
diff changeset
64
72583524cfd3 doc (jp): jp commands are now fully documented:
Goffi <goffi@goffi.org>
parents:
diff changeset
65 Show raw XML stream. By default, output is pretty formatted/highlighted and you get all
72583524cfd3 doc (jp): jp commands are now fully documented:
Goffi <goffi@goffi.org>
parents:
diff changeset
66 streams in both direction. You can filter the direction using ``-d {in,out,both},
72583524cfd3 doc (jp): jp commands are now fully documented:
Goffi <goffi@goffi.org>
parents:
diff changeset
67 --direction {in,out,both}``.
72583524cfd3 doc (jp): jp commands are now fully documented:
Goffi <goffi@goffi.org>
parents:
diff changeset
68
72583524cfd3 doc (jp): jp commands are now fully documented:
Goffi <goffi@goffi.org>
parents:
diff changeset
69 For this to work, you need to set the option ``Activate XML log`` in the ``Debug`` section
72583524cfd3 doc (jp): jp commands are now fully documented:
Goffi <goffi@goffi.org>
parents:
diff changeset
70 of your parameters.
72583524cfd3 doc (jp): jp commands are now fully documented:
Goffi <goffi@goffi.org>
parents:
diff changeset
71
72583524cfd3 doc (jp): jp commands are now fully documented:
Goffi <goffi@goffi.org>
parents:
diff changeset
72 Verbosity is used, to print details on the direction of a stanza, use ``--verbose, -v``
72583524cfd3 doc (jp): jp commands are now fully documented:
Goffi <goffi@goffi.org>
parents:
diff changeset
73
72583524cfd3 doc (jp): jp commands are now fully documented:
Goffi <goffi@goffi.org>
parents:
diff changeset
74 example
72583524cfd3 doc (jp): jp commands are now fully documented:
Goffi <goffi@goffi.org>
parents:
diff changeset
75 -------
72583524cfd3 doc (jp): jp commands are now fully documented:
Goffi <goffi@goffi.org>
parents:
diff changeset
76
72583524cfd3 doc (jp): jp commands are now fully documented:
Goffi <goffi@goffi.org>
parents:
diff changeset
77 Monitor raw XML stream::
72583524cfd3 doc (jp): jp commands are now fully documented:
Goffi <goffi@goffi.org>
parents:
diff changeset
78
3488
c80a0f864b5d doc: updated doc following global renaming
Goffi <goffi@goffi.org>
parents: 3047
diff changeset
79 $ li debug monitor -v
3047
cf843dd7c345 jp (debug): new "theme" command to print colour theme according to `background` value:
Goffi <goffi@goffi.org>
parents: 3041
diff changeset
80
cf843dd7c345 jp (debug): new "theme" command to print colour theme according to `background` value:
Goffi <goffi@goffi.org>
parents: 3041
diff changeset
81 theme
cf843dd7c345 jp (debug): new "theme" command to print colour theme according to `background` value:
Goffi <goffi@goffi.org>
parents: 3041
diff changeset
82 =====
cf843dd7c345 jp (debug): new "theme" command to print colour theme according to `background` value:
Goffi <goffi@goffi.org>
parents: 3041
diff changeset
83
cf843dd7c345 jp (debug): new "theme" command to print colour theme according to `background` value:
Goffi <goffi@goffi.org>
parents: 3041
diff changeset
84 Show the colour constants in their respective colour, according to background (``light``
3536
0985c47ffd96 doc: config file is now `libervia.conf` (even if `sat.conf` still works, for now)
Goffi <goffi@goffi.org>
parents: 3505
diff changeset
85 or ``dark``). If backround option is not set in ``libervia.conf``, it will be autodetected, and
3047
cf843dd7c345 jp (debug): new "theme" command to print colour theme according to `background` value:
Goffi <goffi@goffi.org>
parents: 3041
diff changeset
86 colour theme will be modified accordingly.
cf843dd7c345 jp (debug): new "theme" command to print colour theme according to `background` value:
Goffi <goffi@goffi.org>
parents: 3041
diff changeset
87
cf843dd7c345 jp (debug): new "theme" command to print colour theme according to `background` value:
Goffi <goffi@goffi.org>
parents: 3041
diff changeset
88 example
cf843dd7c345 jp (debug): new "theme" command to print colour theme according to `background` value:
Goffi <goffi@goffi.org>
parents: 3041
diff changeset
89 -------
cf843dd7c345 jp (debug): new "theme" command to print colour theme according to `background` value:
Goffi <goffi@goffi.org>
parents: 3041
diff changeset
90
cf843dd7c345 jp (debug): new "theme" command to print colour theme according to `background` value:
Goffi <goffi@goffi.org>
parents: 3041
diff changeset
91 Show colours with the set background::
cf843dd7c345 jp (debug): new "theme" command to print colour theme according to `background` value:
Goffi <goffi@goffi.org>
parents: 3041
diff changeset
92
3488
c80a0f864b5d doc: updated doc following global renaming
Goffi <goffi@goffi.org>
parents: 3047
diff changeset
93 $ li debug theme