comparison doc/libervia-cli/pubsub.rst @ 3612:21e7d46b988c

doc (cli/pubsub): document pubsub cache management commands
author Goffi <goffi@goffi.org>
date Thu, 29 Jul 2021 22:51:01 +0200
parents ce864968fb23
children 7bc443253b7c
comparison
equal deleted inserted replaced
3611:ce864968fb23 3612:21e7d46b988c
30 ------- 30 -------
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
36 .. _li_pubsub_get:
35 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.
329 .. _RSM: https://xmpp.org/extensions/xep-0059.html 331 .. _RSM: https://xmpp.org/extensions/xep-0059.html
330 332
331 example 333 example
332 ------- 334 -------
333 335
334 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:
335 337
336 .. sourcecode:: python 338 .. sourcecode:: python
337 339
338 #!/usr/bin/env python3 340 #!/usr/bin/env python3
339 341
340 import sys 342 import sys
341 item_raw = sys.stdin.read() 343 item_raw = sys.stdin.read()
342 if not "sàt" in item_raw: 344 if not "SàT" in item_raw:
343 print("SKIP") 345 print("SKIP")
344 else: 346 else:
345 print(item_raw.replace("sàt", "Libervia")) 347 print(item_raw.replace("SàT", "Libervia"))
346 348
347 And save it a some location, e.g. ``~/expand_sat.py`` (don't forget to make is executable 349 And save it a some location, e.g. ``~/expand_sat.py`` (don't forget to make is executable
348 with ``chmod +x ~/expand_sat.py``). 350 with ``chmod +x ~/expand_sat.py``).
349 351
350 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::
379 381
380 hook 382 hook
381 ==== 383 ====
382 384
383 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`.