feat: add doc

This commit is contained in:
egarette@silique.fr 2025-12-23 21:38:51 +01:00
parent 33835d0947
commit 5e62069e57
6 changed files with 141 additions and 36 deletions

21
README.fr.md Normal file
View file

@ -0,0 +1,21 @@
---
gitea: none
include_toc: true
---
[🇬🇧 (EN)](README.md) - [🇫🇷 (FR)](README.fr.md)
## Export de la configuration au format JSON
> [!NOTE]
>
> Exporter la configuration au format JSON permet de traiter plus facilement la configuration dans un outil exterieur par exemple.\
> **Chemin** : json\
> *`désactivé`*\
> **Désactivé** : si json n'est pas présent dans "[Sélection pour sortie](#step.output)"
| Variable | Description | Valeur par défaut | Type |
|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------|
| **<a id="json.mandatory" name="json.mandatory">json.mandatory</a>**<br/>**Ligne de commande** : <br/>&nbsp;--json.mandatory<br/>&nbsp;--json.no-mandatory<br/>**Variable d'environnement** : JSON.MANDATORY | Tester les variables obligatoires avant de l&#x27;afficher en JSON.<br/>La configuration doit être valide avant d&#x27;exporter les données au format JSON. C&#x27;est mieux de valider les valeurs au début du processus. | true si "[La configuration dans l&#x27;état de sortie est dans mode lecture-écriture](#cli.read_write)" est false | [`boolean`](https://rougail.readthedocs.io/en/latest/variable.html#variables-types) `obligatoire` |
| **<a id="json.get" name="json.get">json.get</a>**<br/>**Ligne de commande** : <br/>--json.get<br/>**Variable d'environnement** : JSON.GET | Récupère la valeur pour une variable ou une famille.<br/>Par défaut toute la configuration est exporté en JSON. Il est possible de récupérer les valeurs de variable dans une famille défini ou directement la valeur d&#x27;une variable.<br/>**Exemples** : <br/>&nbsp;family<br/>&nbsp;family.variable | | [`string`](https://rougail.readthedocs.io/en/latest/variable.html#variables-types) |

View file

@ -1,2 +1,21 @@
# rougail-output-json ---
gitea: none
include_toc: true
---
[🇬🇧 (EN)](README.md) - [🇫🇷 (FR)](README.fr.md)
## Export configuration to JSON format
> [!NOTE]
>
> Exporting the configuration in JSON format makes it easier to process the configuration in an external tool, for example.\
> **Path**: json\
> *`disabled`*\
> **Disabled**: if json is not set in "[Select for output](#step.output)"
| Variable | Description | Default value | Type |
|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------|
| **<a id="json.mandatory" name="json.mandatory">json.mandatory</a>**<br/>**Command line**: <br/>&nbsp;--json.mandatory<br/>&nbsp;--json.no-mandatory<br/>**Environment variable**: JSON.MANDATORY | Test mandatories variables before display in JSON.<br/>The configuration must be valid before exporting the data to JSON format. It&#x27;s better to validate the values at the beginning of the process. | true if "[Configuration in output step is in read_write mode](#cli.read_write)" is false | [`boolean`](https://rougail.readthedocs.io/en/latest/variable.html#variables-types) `mandatory` |
| **<a id="json.get" name="json.get">json.get</a>**<br/>**Command line**: <br/>--json.get<br/>**Environment variable**: JSON.GET | Get value for a variable or a family.<br/>By default, the entire configuration is exported as JSON. It is possible to retrieve variable values from a defined family or directly the value of a variable.<br/>**Examples**: <br/>&nbsp;family<br/>&nbsp;family.variable | | [`string`](https://rougail.readthedocs.io/en/latest/variable.html#variables-types) |

View file

@ -5,8 +5,8 @@
msgid "" msgid ""
msgstr "" msgstr ""
"Project-Id-Version: \n" "Project-Id-Version: \n"
"POT-Creation-Date: 2025-10-05 21:25+0200\n" "POT-Creation-Date: 2025-12-24 09:29+0100\n"
"PO-Revision-Date: 2025-10-05 21:26+0200\n" "PO-Revision-Date: 2025-12-24 09:30+0100\n"
"Last-Translator: \n" "Last-Translator: \n"
"Language-Team: \n" "Language-Team: \n"
"Language: fr\n" "Language: fr\n"
@ -14,36 +14,74 @@ msgstr ""
"Content-Type: text/plain; charset=UTF-8\n" "Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n" "Content-Transfer-Encoding: 8bit\n"
"Generated-By: pygettext.py 1.5\n" "Generated-By: pygettext.py 1.5\n"
"X-Generator: Poedit 3.7\n" "X-Generator: Poedit 3.8\n"
#: src/rougail/output_json/__init__.py:48 #: src/rougail/output_json/__init__.py:50
msgid "the \"step.output\" is not set to \"{0}\"" msgid "the \"step.output\" is not set to \"{0}\""
msgstr "\"step.output\" n'est pas mis à \"{0}\"" msgstr "\"step.output\" n'est pas mis à \"{0}\""
#: src/rougail/output_json/__init__.py:105 #: src/rougail/output_json/__init__.py:111
msgid "Error in config: {0}" msgid "Error in config: {0}"
msgstr "Erreur dans la configuration : {0}" msgstr "Erreur dans la configuration : {0}"
#: src/rougail/output_json/__init__.py:115 #: src/rougail/output_json/__init__.py:121
msgid "The following variables are mandatory but have no value:" msgid "The following variables are mandatory but have no value:"
msgstr "Les variables suivantes sont obligatoire mais n'ont pas de valeur :" msgstr "Les variables suivantes sont obligatoire mais n'ont pas de valeur :"
#: src/rougail/output_json/__init__.py:125 #: src/rougail/output_json/__init__.py:131
msgid "The following variables are inaccessible but are empty and mandatory :" msgid "The following variables are inaccessible but are empty and mandatory :"
msgstr "Les variables suivantes sont inaccessibles mais sont vides et obligatoires :" msgstr ""
"Les variables suivantes sont inaccessibles mais sont vides et obligatoires :"
#: src/rougail/output_json/config.py:29 #: src/rougail/output_json/config.py:29
msgid "configuration rougail-json" msgid "Export configuration to JSON format"
msgstr "configuration de rougail-json" msgstr "Export de la configuration au format JSON"
#: src/rougail/output_json/config.py:37 #: src/rougail/output_json/config.py:31
msgid "test mandatories variables before display in json" msgid ""
msgstr "tester les variables obligatoires avant de l'afficher en json" "Exporting the configuration in JSON format makes it easier to process the "
"configuration in an external tool, for example."
msgstr ""
"Exporter la configuration au format JSON permet de traiter plus facilement "
"la configuration dans un outil exterieur par exemple."
#: src/rougail/output_json/config.py:48 #: src/rougail/output_json/config.py:36
msgid "if json is not set in \"step.output\""
msgstr "si json n'est pas présent dans \"step.output\""
#: src/rougail/output_json/config.py:39
msgid "test mandatories variables before display in JSON"
msgstr "tester les variables obligatoires avant de l'afficher en JSON"
#: src/rougail/output_json/config.py:41
msgid ""
"The configuration must be valid before exporting the data to JSON format. "
"It's better to validate the values at the beginning of the process."
msgstr ""
"La configuration doit être valide avant d'exporter les données au format "
"JSON. C'est mieux de valider les valeurs au début du processus."
#: src/rougail/output_json/config.py:46
msgid "true if \"cli.read_write\" is false"
msgstr "true si \"cli.read_write\" est false"
#: src/rougail/output_json/config.py:49
msgid "get value for a variable or a family" msgid "get value for a variable or a family"
msgstr "récupère la valeur pour une variable ou une famille" msgstr "récupère la valeur pour une variable ou une famille"
#: src/rougail/output_json/config.py:51
msgid ""
"By default, the entire configuration is exported as JSON. It is possible to "
"retrieve variable values from a defined family or directly the value of a "
"variable."
msgstr ""
"Par défaut toute la configuration est exporté en JSON. Il est possible de "
"récupérer les valeurs de variable dans une famille défini ou directement la "
"valeur d'une variable."
#~ msgid "configuration rougail-json"
#~ msgstr "configuration de rougail-json"
#~ msgid "display variables available in read_write mode" #~ msgid "display variables available in read_write mode"
#~ msgstr "affiche les variables valables en mode lecture écriture" #~ msgstr "affiche les variables valables en mode lecture écriture"
@ -51,7 +89,8 @@ msgstr "récupère la valeur pour une variable ou une famille"
#~ msgstr "affiche les variables valables en mode lecture seul" #~ msgstr "affiche les variables valables en mode lecture seul"
#~ msgid "do not test mandatories variables before display in json" #~ msgid "do not test mandatories variables before display in json"
#~ msgstr "ne pas tester les variables obligatoires avant de l'afficher en json" #~ msgstr ""
#~ "ne pas tester les variables obligatoires avant de l'afficher en json"
#~ msgid "Undocumented variable" #~ msgid "Undocumented variable"
#~ msgstr "Variable non documentée" #~ msgstr "Variable non documentée"

View file

@ -5,7 +5,7 @@
msgid "" msgid ""
msgstr "" msgstr ""
"Project-Id-Version: PACKAGE VERSION\n" "Project-Id-Version: PACKAGE VERSION\n"
"POT-Creation-Date: 2025-10-05 21:26+0200\n" "POT-Creation-Date: 2025-12-24 09:30+0100\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n" "Language-Team: LANGUAGE <LL@li.org>\n"
@ -15,31 +15,51 @@ msgstr ""
"Generated-By: pygettext.py 1.5\n" "Generated-By: pygettext.py 1.5\n"
#: src/rougail/output_json/__init__.py:48 #: src/rougail/output_json/__init__.py:50
msgid "the \"step.output\" is not set to \"{0}\"" msgid "the \"step.output\" is not set to \"{0}\""
msgstr "" msgstr ""
#: src/rougail/output_json/__init__.py:105 #: src/rougail/output_json/__init__.py:111
msgid "Error in config: {0}" msgid "Error in config: {0}"
msgstr "" msgstr ""
#: src/rougail/output_json/__init__.py:115 #: src/rougail/output_json/__init__.py:121
msgid "The following variables are mandatory but have no value:" msgid "The following variables are mandatory but have no value:"
msgstr "" msgstr ""
#: src/rougail/output_json/__init__.py:125 #: src/rougail/output_json/__init__.py:131
msgid "The following variables are inaccessible but are empty and mandatory :" msgid "The following variables are inaccessible but are empty and mandatory :"
msgstr "" msgstr ""
#: src/rougail/output_json/config.py:29 #: src/rougail/output_json/config.py:29
msgid "configuration rougail-json" msgid "Export configuration to JSON format"
msgstr "" msgstr ""
#: src/rougail/output_json/config.py:37 #: src/rougail/output_json/config.py:31
msgid "test mandatories variables before display in json" msgid "Exporting the configuration in JSON format makes it easier to process the configuration in an external tool, for example."
msgstr "" msgstr ""
#: src/rougail/output_json/config.py:48 #: src/rougail/output_json/config.py:36
msgid "if json is not set in \"step.output\""
msgstr ""
#: src/rougail/output_json/config.py:39
msgid "test mandatories variables before display in JSON"
msgstr ""
#: src/rougail/output_json/config.py:41
msgid "The configuration must be valid before exporting the data to JSON format. It's better to validate the values at the beginning of the process."
msgstr ""
#: src/rougail/output_json/config.py:46
msgid "true if \"cli.read_write\" is false"
msgstr ""
#: src/rougail/output_json/config.py:49
msgid "get value for a variable or a family" msgid "get value for a variable or a family"
msgstr "" msgstr ""
#: src/rougail/output_json/config.py:51
msgid "By default, the entire configuration is exported as JSON. It is possible to retrieve variable values from a defined family or directly the value of a variable."
msgstr ""

View file

@ -26,26 +26,32 @@ def get_rougail_config(
) -> dict: ) -> dict:
options = f""" options = f"""
json: json:
description: {_('configuration rougail-json')} description: {_('Export configuration to JSON format')}
help: |-
{_('Exporting the configuration in JSON format makes it easier to process the configuration in an external tool, for example.')}
disabled: disabled:
jinja: | jinja: |-
{{% if step.output is propertyerror or step.output != 'json' %}} {{{{ step.output is propertyerror or step.output != 'json' }}}}
disabled return_type: boolean
{{% endif %}} description: {_('if json is not set in "step.output"')}
mandatory: mandatory:
description: {_('test mandatories variables before display in json')} description: {_('test mandatories variables before display in JSON')}
help: |-
{_("The configuration must be valid before exporting the data to JSON format. It's better to validate the values at the beginning of the process.")}
type: boolean type: boolean
default: default:
jinja: |- jinja: |-
{{% if cli.read_write is defined and cli.read_write %}} {{{{ cli.read_write is not defined or not cli.read_write }}}}
false description: {_('true if "cli.read_write" is false')}
{{% else %}}
true
{{% endif %}}
get: get:
description: {_('get value for a variable or a family')} description: {_('get value for a variable or a family')}
help: |-
{_('By default, the entire configuration is exported as JSON. It is possible to retrieve variable values from a defined family or directly the value of a variable.')}
examples:
- family
- family.variable
mandatory: false mandatory: false
""" """
return { return {