comparison doc/libervia-cli/pubsub.rst @ 3715:b9718216a1c0 0.9

merge bookmark 0.9
author Goffi <goffi@goffi.org>
date Wed, 01 Dec 2021 16:13:31 +0100
parents 7bc443253b7c
children e597dbfbc4c6
comparison
equal deleted inserted replaced
3714:af09b5aaa5d7 3715:b9718216a1c0
31 31
32 Create an item with a custom note XML:: 32 Create an item with a custom note XML::
33 33
34 $ echo '<note xmlns="http://example.net/mynotes">this is a note</note>' | li pubsub set -n "notes" 34 $ echo '<note xmlns="http://example.net/mynotes">this is a note</note>' | li pubsub set -n "notes"
35 35
36 .. _li_pubsub_get:
37
36 get 38 get
37 === 39 ===
38 40
39 Retrieve items from specified node. Default output is prettified and highlighted XML. 41 Retrieve items from specified node. Default output is prettified and highlighted XML.
40 42
41 example 43 example
42 ------- 44 -------
43 45
44 Retrieve the last 5 notes from our custom notes node:: 46 Retrieve the last 5 notes from our custom notes node::
45 47
46 $ li pubsub get -n notes -m 5 48 $ li pubsub get -n notes -M 5
47 49
48 .. _li_pubsub_delete: 50 .. _li_pubsub_delete:
49 51
50 delete 52 delete
51 ====== 53 ======
52 54
53 Delete an item from a node. If ``-N, --notify`` is specified, subscribers will be notified 55 Delete an item from a node. If ``--no-notification`` is specified, subscribers wont be notified
54 of the item retraction. 56 of the item retraction (this is NOT recommended, as it will cause trouble to keep items in
57 sync, take caution when using this flag).
55 58
56 By default a confirmation is requested before deletion is requested to the PubSub service, 59 By default a confirmation is requested before deletion is requested to the PubSub service,
57 but you can override this behaviour by using ``-f, --force`` option. 60 but you can override this behaviour by using ``-f, --force`` option.
58 61
59 example 62 example
328 .. _RSM: https://xmpp.org/extensions/xep-0059.html 331 .. _RSM: https://xmpp.org/extensions/xep-0059.html
329 332
330 example 333 example
331 ------- 334 -------
332 335
333 Imagine that you want to replace all occurrences of "sàt" by "Libervia" in your personal blog. You first create a Python script like this: 336 Imagine that you want to replace all occurrences of "SàT" by "Libervia" in your personal blog. You first create a Python script like this:
334 337
335 .. sourcecode:: python 338 .. sourcecode:: python
336 339
337 #!/usr/bin/env python3 340 #!/usr/bin/env python3
338 341
339 import sys 342 import sys
340 item_raw = sys.stdin.read() 343 item_raw = sys.stdin.read()
341 if not "sàt" in item_raw: 344 if not "SàT" in item_raw:
342 print("SKIP") 345 print("SKIP")
343 else: 346 else:
344 print(item_raw.replace("sàt", "Libervia")) 347 print(item_raw.replace("SàT", "Libervia"))
345 348
346 And save it a some location, e.g. ``~/expand_sat.py`` (don't forget to make it executable 349 And save it a some location, e.g. ``~/expand_sat.py`` (don't forget to make it executable
347 with ``chmod +x ~/expand_sat.py``). 350 with ``chmod +x ~/expand_sat.py``).
348 351
349 To be sure it's safe, you can first do a dry-run and check the result:: 352 To be sure it's safe, you can first do a dry-run and check the result::
378 381
379 hook 382 hook
380 ==== 383 ====
381 384
382 Subcommands for hooks management. Please check :ref:`libervia-cli_pubsub_hook`. 385 Subcommands for hooks management. Please check :ref:`libervia-cli_pubsub_hook`.
386
387 cache
388 =====
389
390 Subcommands for cache management. Please check :ref:`libervia-cli_pubsub_cache`.