feat: first commit

This commit is contained in:
egarette@silique.fr 2026-07-10 08:22:19 +02:00
parent 959879924c
commit 2fe70e3b13
813 changed files with 2563 additions and 1 deletions

37
README.fr.md Normal file
View file

@ -0,0 +1,37 @@
---
gitea: none
include_toc: true
---
[🇬🇧 (EN)](README.md) - [🇫🇷 (FR)](README.fr.md)
## Exporte la configuration dans des variables d'environnement
> [!NOTE]
>
> L'exportation de la configuration sous forme de variables d'environnement la rend accessible aux applications nécessitant ce type de variable (scripts, applications Twelve-Factor, etc.).\
> \
> Vous pouvez l'utiliser, avec le fichier .rougailconf.yaml approprié, en exécutant : "source <(rougail)".\
> \
> Note : une variable dans un "sequence" qui serait désactivée pour un index particulier sera remplacé par une chaine vide.\
> **Chemin** : environment\
> *`désactivé`*\
> **Désactivé** : lorsque la variable "[sélection pour sortie](#step.output)" est accessible et n'a pas la valeur "environment".
### Configuration pour la sortie type environment
> [!NOTE]
>
> **Chemin** : environment.output\
> *`désactivé`*\
> **Désactivé** : lorsque la variable "[sélection pour sortie](#step.output)" est accessible et n'a pas la valeur "environment".
| Variable | Description | Valeur par défaut | Type | Contrôle des accès | Validateur |
|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|--------------------------------------------------|
| **<a id="environment.output.prefix" name="environment.output.prefix">environment.output.prefix</a>**<br/>**Ligne de commande** : <br/>--environment.output.prefix<br/>**Variable d'environnement** : ROUGAILCLI_ENVIRONMENT.OUTPUT.PREFIX | Ajouter un préfixe aux variables d&#x27;environnement. | | [`string`](https://rougail.readthedocs.io/en/latest/variable.html#variables-types) | | |
| **<a id="environment.output.boolean_type" name="environment.output.boolean_type">environment.output.boolean_type</a>**<br/>**Ligne de commande** : <br/>--environment.output.boolean_type<br/>**Variable d'environnement** : ROUGAILCLI_ENVIRONMENT.OUTPUT.BOOLEAN_TYPE | Les booléens sont convertis en.<br/>Il n&#x27;y a pas de booléen dans le shell, nous devons donc le convertir<br/><br/>&quot;string&quot; signifie les chaînes de caractères &quot;true&quot; ou &quot;false&quot;<br/><br/>&quot;number&quot; signifie les nombres &quot;1&quot; ou &quot;0&quot;. | string | [`choice`](https://rougail.readthedocs.io/en/latest/variable.html#variables-types) `obligatoire` | | **Choix** : <br/>&nbsp;string<br/>&nbsp;number |
| **<a id="environment.output.upper" name="environment.output.upper">environment.output.upper</a>**<br/>**Ligne de commande** : <br/>&nbsp;--environment.output.upper<br/>&nbsp;--environment.output.no-upper<br/>**Variable d'environnement** : ROUGAILCLI_ENVIRONMENT.OUTPUT.UPPER | Le nom des variables sont en majuscule. | true | [`boolean`](https://rougail.readthedocs.io/en/latest/variable.html#variables-types) `obligatoire` | | |
| **<a id="environment.output.path_is_variable_name" name="environment.output.path_is_variable_name">environment.output.path_is_variable_name</a>**<br/>**Ligne de commande** : <br/>&nbsp;--environment.output.path_is_variable_name<br/>&nbsp;--environment.output.no-path_is_variable_name<br/>**Variable d'environnement** : ROUGAILCLI_ENVIRONMENT.OUTPUT.PATH_IS_VARIABLE_NAME | Le nom des variables est, en fait, un chemin. | true | [`boolean`](https://rougail.readthedocs.io/en/latest/variable.html#variables-types) `obligatoire` | | |
| **<a id="environment.output.custom_separator" name="environment.output.custom_separator">environment.output.custom_separator</a>**<br/>**Ligne de commande** : <br/>--environment.output.custom_separator<br/>**Variable d'environnement** : ROUGAILCLI_ENVIRONMENT.OUTPUT.CUSTOM_SEPARATOR | Remplace le caractère de séparateur &quot;.&quot; dans le chemin par un autre.<br/>Le caractère point (&quot;.&quot;) peut ne pas être autoriser dans le nom des variables d&#x27;environnement. | _ | [`string`](https://rougail.readthedocs.io/en/latest/variable.html#variables-types) | *`désactivé`*<br/>**Désactivé** : lorsque la variable "[Le nom des variables est, en fait, un chemin](#environment.output.path_is_variable_name)" a la valeur "false". | |
| **<a id="environment.output.multi_in_array" name="environment.output.multi_in_array">environment.output.multi_in_array</a>**<br/>**Ligne de commande** : <br/>&nbsp;--environment.output.multi_in_array<br/>&nbsp;--environment.output.no-multi_in_array<br/>**Variable d'environnement** : ROUGAILCLI_ENVIRONMENT.OUTPUT.MULTI_IN_ARRAY | Variables a multiple valeurs vont être chargé dans un array.<br/>Tous les shells ne prennent pas en charge les arrays. Cette fonctionnalité n&#x27;est pas compatible POSIX, elle est spécifique à Bash (d&#x27;autres shells, comme zsh ou ksh, prennent également en charge les arrays).<br/><br/>Si votre shell prend en charge les arrays, il est préférable de les utiliser pour parcourir les valeurs de la liste. | true | [`boolean`](https://rougail.readthedocs.io/en/latest/variable.html#variables-types) `obligatoire` | | |
| **<a id="environment.output.multi_separator" name="environment.output.multi_separator">environment.output.multi_separator</a>**<br/>**Ligne de commande** : <br/>--environment.output.multi_separator<br/>**Variable d'environnement** : ROUGAILCLI_ENVIRONMENT.OUTPUT.MULTI_SEPARATOR | Le séparateur pour les variables à valeurs multiples. | ; | [`string`](https://rougail.readthedocs.io/en/latest/variable.html#variables-types) `obligatoire` | *`désactivé`*<br/>**Désactivé** : lorsque la variable "[Variables a multiple valeurs vont être chargé dans un array](#environment.output.multi_in_array)" a la valeur "true". | |
| **<a id="environment.output.submulti_separator" name="environment.output.submulti_separator">environment.output.submulti_separator</a>**<br/>**Ligne de commande** : <br/>--environment.output.submulti_separator<br/>**Variable d'environnement** : ROUGAILCLI_ENVIRONMENT.OUTPUT.SUBMULTI_SEPARATOR | Le séparateur pour les variables à sous valeurs multiples. | si "[Variables a multiple valeurs vont être chargé dans un array](#environment.output.multi_in_array)" la valeur est ";" sinon la valeur est ",". | [`string`](https://rougail.readthedocs.io/en/latest/variable.html#variables-types) `obligatoire` | | |

View file

@ -1,2 +1,37 @@
# rougail-output-environment ---
gitea: none
include_toc: true
---
[🇬🇧 (EN)](README.md) - [🇫🇷 (FR)](README.fr.md)
## Export configuration to environment variables
> [!NOTE]
>
> Exporting the configuration as an environment variable makes it available to applications that require this type of variable (scripts, Twelve-Factor Apps, etc.).\
> \
> You can use it, with the appropriate .rougailconf.yaml file, by doing: "source <(rougail)".\
> \
> Note: A variable within a "sequence" that is disabled for a specific index will be replaced by an empty string.\
> **Path**: environment\
> *`disabled`*\
> **Disabled**: when the variable "[select for output](#step.output)" is accessible and hasn't the value "environment".
### Configuration for output environment
> [!NOTE]
>
> **Path**: environment.output\
> *`disabled`*\
> **Disabled**: when the variable "[select for output](#step.output)" is accessible and hasn't the value "environment".
| Variable | Description | Default value | Type | Access control | Validator |
|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------|
| **<a id="environment.output.prefix" name="environment.output.prefix">environment.output.prefix</a>**<br/>**Command line**: <br/>--environment.output.prefix<br/>**Environment variable**: ROUGAILCLI_ENVIRONMENT.OUTPUT.PREFIX | Add prefix to environment variables. | | [`string`](https://rougail.readthedocs.io/en/latest/variable.html#variables-types) | | |
| **<a id="environment.output.boolean_type" name="environment.output.boolean_type">environment.output.boolean_type</a>**<br/>**Command line**: <br/>--environment.output.boolean_type<br/>**Environment variable**: ROUGAILCLI_ENVIRONMENT.OUTPUT.BOOLEAN_TYPE | Booleans are converted into.<br/>There is no boolean in shell, so we have to convert it<br/><br/>&quot;string&quot; means the string &quot;true&quot; or &quot;false&quot;<br/><br/>&quot;number&quot; means the number &quot;1&quot; or &quot;0&quot;. | string | [`choice`](https://rougail.readthedocs.io/en/latest/variable.html#variables-types) `mandatory` | | **Choices**: <br/>&nbsp;string<br/>&nbsp;number |
| **<a id="environment.output.upper" name="environment.output.upper">environment.output.upper</a>**<br/>**Command line**: <br/>&nbsp;--environment.output.upper<br/>&nbsp;--environment.output.no-upper<br/>**Environment variable**: ROUGAILCLI_ENVIRONMENT.OUTPUT.UPPER | Variables name are upper. | true | [`boolean`](https://rougail.readthedocs.io/en/latest/variable.html#variables-types) `mandatory` | | |
| **<a id="environment.output.path_is_variable_name" name="environment.output.path_is_variable_name">environment.output.path_is_variable_name</a>**<br/>**Command line**: <br/>&nbsp;--environment.output.path_is_variable_name<br/>&nbsp;--environment.output.no-path_is_variable_name<br/>**Environment variable**: ROUGAILCLI_ENVIRONMENT.OUTPUT.PATH_IS_VARIABLE_NAME | The variables name is, in fact, the path. | true | [`boolean`](https://rougail.readthedocs.io/en/latest/variable.html#variables-types) `mandatory` | | |
| **<a id="environment.output.custom_separator" name="environment.output.custom_separator">environment.output.custom_separator</a>**<br/>**Command line**: <br/>--environment.output.custom_separator<br/>**Environment variable**: ROUGAILCLI_ENVIRONMENT.OUTPUT.CUSTOM_SEPARATOR | Replace the separator character &quot;.&quot; in path by an other.<br/>The character dot (&quot;.&quot;) may not be allowed in the environment variable name. | _ | [`string`](https://rougail.readthedocs.io/en/latest/variable.html#variables-types) | *`disabled`*<br/>**Disabled**: when the variable "[The variables name is, in fact, the path](#environment.output.path_is_variable_name)" has the value "false". | |
| **<a id="environment.output.multi_in_array" name="environment.output.multi_in_array">environment.output.multi_in_array</a>**<br/>**Command line**: <br/>&nbsp;--environment.output.multi_in_array<br/>&nbsp;--environment.output.no-multi_in_array<br/>**Environment variable**: ROUGAILCLI_ENVIRONMENT.OUTPUT.MULTI_IN_ARRAY | Multiple values variable will be loaded in a array.<br/>Not all shells support arrays. This feature is not POSIX-compatible, it&#x27;s a Bash-specific feature (other shells like zsh or ksh also support arrays).<br/><br/>If your shell supports arrays, it is preferable to use them to iterate over the values in the list. | true | [`boolean`](https://rougail.readthedocs.io/en/latest/variable.html#variables-types) `mandatory` | | |
| **<a id="environment.output.multi_separator" name="environment.output.multi_separator">environment.output.multi_separator</a>**<br/>**Command line**: <br/>--environment.output.multi_separator<br/>**Environment variable**: ROUGAILCLI_ENVIRONMENT.OUTPUT.MULTI_SEPARATOR | The separator for multiple values variable. | ; | [`string`](https://rougail.readthedocs.io/en/latest/variable.html#variables-types) `mandatory` | *`disabled`*<br/>**Disabled**: when the variable "[Multiple values variable will be loaded in a array](#environment.output.multi_in_array)" has the value "true". | |
| **<a id="environment.output.submulti_separator" name="environment.output.submulti_separator">environment.output.submulti_separator</a>**<br/>**Command line**: <br/>--environment.output.submulti_separator<br/>**Environment variable**: ROUGAILCLI_ENVIRONMENT.OUTPUT.SUBMULTI_SEPARATOR | The separator for sub multiple values variable. | if "[Multiple values variable will be loaded in a array](#environment.output.multi_in_array)" the value is ";" otherwise the value is ",". | [`string`](https://rougail.readthedocs.io/en/latest/variable.html#variables-types) `mandatory` | | |

View file

@ -0,0 +1,166 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR ORGANIZATION
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
msgid ""
msgstr ""
"Project-Id-Version: \n"
"POT-Creation-Date: 2026-07-10 07:49+0200\n"
"PO-Revision-Date: 2026-07-10 07:51+0200\n"
"Last-Translator: \n"
"Language-Team: \n"
"Language: fr\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Generated-By: pygettext.py 1.5\n"
"X-Generator: Poedit 3.9\n"
#: src/rougail/output_environment/config.py:31
msgid ""
"Load user data from environment variables or export configuration to "
"environment variables"
msgstr ""
"Charge les données utilisateurs depuis les variables d'environnement ou "
"export la configuration vers les variables d'environnement"
#: src/rougail/output_environment/config.py:38
msgid "if environment is not in \"step.output\" and not in \"step.user_data\""
msgstr ""
"Si environment n'est pas dans \"step.output\" ou dans \"step.user_data\""
#: src/rougail/output_environment/config.py:43
msgid "Export configuration to environment variables"
msgstr "Exporte la configuration dans des variables d'environnement"
#: src/rougail/output_environment/config.py:45
msgid ""
"Exporting the configuration as an environment variable makes it available to "
"applications that require this type of variable (scripts, Twelve-Factor "
"Apps, etc.)."
msgstr ""
"L'exportation de la configuration sous forme de variables d'environnement la "
"rend accessible aux applications nécessitant ce type de variable (scripts, "
"applications Twelve-Factor, etc.)."
#: src/rougail/output_environment/config.py:47
msgid ""
"You can use it, with the appropriate .rougailconf.yaml file, by doing: "
"\"source <(rougail)\"."
msgstr ""
"Vous pouvez l'utiliser, avec le fichier .rougailconf.yaml approprié, en "
"exécutant : \"source <(rougail)\"."
#: src/rougail/output_environment/config.py:49
msgid ""
"Note: A variable within a \"sequence\" that is disabled for a specific index "
"will be replaced by an empty string."
msgstr ""
"Note : une variable dans un \"sequence\" qui serait désactivée pour un index "
"particulier sera remplacé par une chaine vide"
#: src/rougail/output_environment/config.py:58
msgid "Configuration for output environment"
msgstr "Configuration pour la sortie type environment"
#: src/rougail/output_environment/config.py:65
msgid "Add prefix to environment variables"
msgstr "Ajouter un préfixe aux variables d'environnement"
#: src/rougail/output_environment/config.py:69
msgid "Booleans are converted into"
msgstr "Les booléens sont convertis en"
#: src/rougail/output_environment/config.py:71
msgid "There is no boolean in shell, so we have to convert it"
msgstr "Il n'y a pas de booléen dans le shell, nous devons donc le convertir"
#: src/rougail/output_environment/config.py:73
msgid "\"string\" means the string \"true\" or \"false\""
msgstr "\"string\" signifie les chaînes de caractères \"true\" ou \"false\""
#: src/rougail/output_environment/config.py:75
msgid "\"number\" means the number \"1\" or \"0\""
msgstr "\"number\" signifie les nombres \"1\" ou \"0\""
#: src/rougail/output_environment/config.py:81
msgid "Variables name are upper"
msgstr "Le nom des variables sont en majuscule"
#: src/rougail/output_environment/config.py:83
msgid "The variables name is, in fact, the path"
msgstr "Le nom des variables est, en fait, un chemin"
#: src/rougail/output_environment/config.py:86
msgid "Replace the separator character \".\" in path by an other"
msgstr "Remplace le caractère de séparateur \".\" dans le chemin par un autre"
#: src/rougail/output_environment/config.py:87
msgid ""
"The character dot (\".\") may not be allowed in the environment variable "
"name."
msgstr ""
"Le caractère point (\".\") peut ne pas être autoriser dans le nom des "
"variables d'environnement"
#: src/rougail/output_environment/config.py:95
msgid "Multiple values variable will be loaded in a array"
msgstr "Variables a multiple valeurs vont être chargé dans un array"
#: src/rougail/output_environment/config.py:97
msgid ""
"Not all shells support arrays. This feature is not POSIX-compatible, it's a "
"Bash-specific feature (other shells like zsh or ksh also support arrays)."
msgstr ""
"Tous les shells ne prennent pas en charge les arrays. Cette fonctionnalité "
"n'est pas compatible POSIX, elle est spécifique à Bash (d'autres shells, "
"comme zsh ou ksh, prennent également en charge les arrays)."
#: src/rougail/output_environment/config.py:99
msgid ""
"If your shell supports arrays, it is preferable to use them to iterate over "
"the values in the list."
msgstr ""
"Si votre shell prend en charge les arrays, il est préférable de les utiliser "
"pour parcourir les valeurs de la liste."
#: src/rougail/output_environment/config.py:103
msgid "The separator for multiple values variable"
msgstr "Le séparateur pour les variables à valeurs multiples"
#: src/rougail/output_environment/config.py:110
msgid "The separator for sub multiple values variable"
msgstr "Le séparateur pour les variables à sous valeurs multiples"
#: src/rougail/output_environment/config.py:119
msgid "if \"_.multi_in_array\" the value is \";\" otherwise the value is \",\""
msgstr "si \"_.multi_in_array\" la valeur est \";\" sinon la valeur est \",\""
#: src/rougail/output_environment/export.py:46
msgid "the \"step.output\" is not set to \"{0}\""
msgstr "le \"step.output\" n'est pas défini à \"{0}\""
#: src/rougail/output_environment/export.py:112
#: src/rougail/output_environment/export.py:124
msgid "{0}: {1}"
msgstr "{0} : {1}"
#: src/rougail/output_environment/export.py:160
msgid "The variable name \"{0}\" is duplicated"
msgstr "Le nom de la variable \"{0}\" est dupliqué"
#: src/rougail/output_environment/export.py:178
msgid ""
"the character \"{0}\" is a sub multi separator, this character must not in "
"the \"{1}\" value"
msgstr ""
"le caractère \"{0}\" est un séparateur pour une valeur sub multiple, ce "
"caractère ne doit pas être dans la valeur de \"{1}\""
#: src/rougail/output_environment/export.py:183
msgid ""
"the character \"{0}\" is a multi separator, this character must not in the "
"\"{1}\" value"
msgstr ""
"le caractère \"{0}\" est un séparateur pour une valeur multiple, ce "
"caractère ne doit pas être dans la valeur de \"{1}\""

View file

@ -0,0 +1,126 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR ORGANIZATION
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"POT-Creation-Date: 2026-07-10 07:51+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Generated-By: pygettext.py 1.5\n"
#: src/rougail/output_environment/config.py:31
msgid "Load user data from environment variables or export configuration to environment variables"
msgstr ""
#: src/rougail/output_environment/config.py:38
msgid "if environment is not in \"step.output\" and not in \"step.user_data\""
msgstr ""
#: src/rougail/output_environment/config.py:43
msgid "Export configuration to environment variables"
msgstr ""
#: src/rougail/output_environment/config.py:45
msgid "Exporting the configuration as an environment variable makes it available to applications that require this type of variable (scripts, Twelve-Factor Apps, etc.)."
msgstr ""
#: src/rougail/output_environment/config.py:47
msgid "You can use it, with the appropriate .rougailconf.yaml file, by doing: \"source <(rougail)\"."
msgstr ""
#: src/rougail/output_environment/config.py:49
msgid "Note: A variable within a \"sequence\" that is disabled for a specific index will be replaced by an empty string."
msgstr ""
#: src/rougail/output_environment/config.py:58
msgid "Configuration for output environment"
msgstr ""
#: src/rougail/output_environment/config.py:65
msgid "Add prefix to environment variables"
msgstr ""
#: src/rougail/output_environment/config.py:69
msgid "Booleans are converted into"
msgstr ""
#: src/rougail/output_environment/config.py:71
msgid "There is no boolean in shell, so we have to convert it"
msgstr ""
#: src/rougail/output_environment/config.py:73
msgid "\"string\" means the string \"true\" or \"false\""
msgstr ""
#: src/rougail/output_environment/config.py:75
msgid "\"number\" means the number \"1\" or \"0\""
msgstr ""
#: src/rougail/output_environment/config.py:81
msgid "Variables name are upper"
msgstr ""
#: src/rougail/output_environment/config.py:83
msgid "The variables name is, in fact, the path"
msgstr ""
#: src/rougail/output_environment/config.py:86
msgid "Replace the separator character \".\" in path by an other"
msgstr ""
#: src/rougail/output_environment/config.py:87
msgid "The character dot (\".\") may not be allowed in the environment variable name."
msgstr ""
#: src/rougail/output_environment/config.py:95
msgid "Multiple values variable will be loaded in a array"
msgstr ""
#: src/rougail/output_environment/config.py:97
msgid "Not all shells support arrays. This feature is not POSIX-compatible, it's a Bash-specific feature (other shells like zsh or ksh also support arrays)."
msgstr ""
#: src/rougail/output_environment/config.py:99
msgid "If your shell supports arrays, it is preferable to use them to iterate over the values in the list."
msgstr ""
#: src/rougail/output_environment/config.py:103
msgid "The separator for multiple values variable"
msgstr ""
#: src/rougail/output_environment/config.py:110
msgid "The separator for sub multiple values variable"
msgstr ""
#: src/rougail/output_environment/config.py:119
msgid "if \"_.multi_in_array\" the value is \";\" otherwise the value is \",\""
msgstr ""
#: src/rougail/output_environment/export.py:46
msgid "the \"step.output\" is not set to \"{0}\""
msgstr ""
#: src/rougail/output_environment/export.py:112
#: src/rougail/output_environment/export.py:124
msgid "{0}: {1}"
msgstr ""
#: src/rougail/output_environment/export.py:160
msgid "The variable name \"{0}\" is duplicated"
msgstr ""
#: src/rougail/output_environment/export.py:178
msgid "the character \"{0}\" is a sub multi separator, this character must not in the \"{1}\" value"
msgstr ""
#: src/rougail/output_environment/export.py:183
msgid "the character \"{0}\" is a multi separator, this character must not in the \"{1}\" value"
msgstr ""

42
pyproject.toml Normal file
View file

@ -0,0 +1,42 @@
[build-system]
build-backend = "flit_core.buildapi"
requires = ["flit_core >=3.8.0,<4"]
[project]
name = "rougail.output_environment"
version = "0.0.0"
authors = [{name = "Emmanuel Garette", email = "gnunux@gnunux.info"}]
readme = "README.md"
description = "Rougail output environment"
requires-python = ">=3.11"
license = {file = "LICENSE"}
classifiers = [
"License :: OSI Approved :: GNU Library or Lesser General Public License (LGPL)",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Programming Language :: Python :: 3.14",
"Programming Language :: Python :: 3",
"Operating System :: OS Independent",
"Natural Language :: English",
"Natural Language :: French",
]
dependencies = [
"rougail-base >= 1.2.0,<2",
]
[project.urls]
Home = "https://forge.cloud.silique.fr/stove/rougail-output-environment"
[tool.commitizen]
name = "cz_conventional_commits"
tag_format = "$version"
version_scheme = "pep440"
version_provider = "pep621"
version_files = [
"src/rougail/output_environment/__version__.py",
"pyproject.toml:version"
]
update_changelog_on_bump = true
changelog_merge_prerelease = true

View file

@ -0,0 +1,27 @@
"""
Silique (https://www.silique.fr)
Copyright (C) 2026
This program is free software: you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as published by the
Free Software Foundation, either version 3 of the License, or (at your
option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
details.
You should have received a copy of the GNU Lesser General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
"""
from .export import RougailOutputEnvironment
from .__version__ import __version__
RougailOutput = RougailOutputEnvironment
__all__ = ("RougailOutputEnvironment", "__version__")

View file

@ -0,0 +1 @@
__version__ = "0.0.0"

View file

@ -0,0 +1,130 @@
"""
Silique (https://www.silique.fr)
Copyright (C) 2026
This program is free software: you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as published by the
Free Software Foundation, either version 3 of the License, or (at your
option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
details.
You should have received a copy of the GNU Lesser General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
"""
from .i18n import _
def get_rougail_config(
*,
backward_compatibility=True,
) -> dict:
options = [f"""
environment:
exists: true
redefine: true
description: {_("Load user data from environment variables or export configuration to environment variables")}
help: null
disabled:
jinja: |-
{{{{ (step.output is propertyerror or step.output != 'environment') and (step.user_data is propertyerror or 'environment' not in step.user_data) }}}}
return_type: boolean
description: >-
{_('if environment is not in "step.output" and not in "step.user_data"')}
""", f"""
environment:
exists: false
type: family
description: {_('Export configuration to environment variables')}
help: |-
{_('Exporting the configuration as an environment variable makes it available to applications that require this type of variable (scripts, Twelve-Factor Apps, etc.).')}
{_('You can use it, with the appropriate .rougailconf.yaml file, by doing: "source <(rougail)".')}
{_('Note: A variable within a "sequence" that is disabled for a specific index will be replaced by an empty string.')}
disabled:
variable: step.output
when_not: environment
propertyerror: false
""", f"""
environment:
output:
description: {_('Configuration for output environment')}
disabled:
variable: step.output
when_not: environment
propertyerror: false
prefix:
description: {_('Add prefix to environment variables')}
mandatory: false
boolean_type:
description: {_('Booleans are converted into')}
help: |-
{_('There is no boolean in shell, so we have to convert it')}
{_('"string" means the string "true" or "false"')}
{_('"number" means the number "1" or "0"')}
choices:
- string
- number
default: string
upper: true # {_('Variables name are upper')}
path_is_variable_name: true # {_('The variables name is, in fact, the path')}
custom_separator:
description: {_('Replace the separator character "." in path by an other')}
help: {_('The character dot (".") may not be allowed in the environment variable name.')}
mandatory: false
disabled:
variable: _.path_is_variable_name
when: false
default: "_"
multi_in_array:
description: {_('Multiple values variable will be loaded in a array')}
help: |-
{_('Not all shells support arrays. This feature is not POSIX-compatible, it\'s a Bash-specific feature (other shells like zsh or ksh also support arrays).')}
{_('If your shell supports arrays, it is preferable to use them to iterate over the values in the list.')}
default: true
multi_separator:
description: {_('The separator for multiple values variable')}
help:
default: ;
disabled:
variable: _.multi_in_array
submulti_separator:
description: {_('The separator for sub multiple values variable')}
default:
jinja: |-
{{% if _.multi_in_array %}}
;
{{% else %}}
,
{{% endif %}}
description: >-
{_('if "_.multi_in_array" the value is ";" otherwise the value is ","')}
"""]
return {
"name": "environment",
"process": "output",
"options": options,
"level": 60,
}
__all__ = ("get_rougail_config",)

View file

@ -0,0 +1,219 @@
"""
Silique (https://www.silique.fr)
Copyright (C) 2026
This program is free software: you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as published by the
Free Software Foundation, either version 3 of the License, or (at your
option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
details.
You should have received a copy of the GNU Lesser General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
"""
from shlex import quote
from rougail.error import ExtensionError
from .i18n import _
class RougailOutputEnvironment:
output_name = "environment"
def __init__(
self,
config: "Config",
*,
rougailconfig: "RougailConfig" = None,
user_data_errors: Optional[list] = None,
user_data_warnings: Optional[list] = None,
true_config: "Config" = None,
**kwargs,
) -> None:
if rougailconfig is None:
from rougail import RougailConfig
rougailconfig = RougailConfig
rougailconfig["step.output"] = self.output_name
if rougailconfig["step.output"] != self.output_name:
raise ExtensionError(
_('the "step.output" is not set to "{0}"').format(self.output_name)
)
self.rougailconfig = rougailconfig
self.config = config
if true_config:
self.true_config = true_config
else:
self.true_config = config
if user_data_errors:
self.errors = user_data_errors
else:
self.errors = []
if user_data_warnings:
self.warnings = user_data_warnings
else:
self.warnings = []
def run(self) -> None:
self.prefix = self.rougailconfig["environment.output.prefix"] or ""
if self.rougailconfig["environment.output.boolean_type"] == "string":
self.booleans = {True: "true", False: "false"}
else:
self.booleans = {True: 1, False: 0}
self.upper = self.rougailconfig["environment.output.upper"]
self.path_is_variable_name = self.rougailconfig["environment.output.path_is_variable_name"]
if self.path_is_variable_name:
self.custom_separator = self.rougailconfig["environment.output.custom_separator"]
else:
self.custom_separator = None
self.multi_in_array = self.rougailconfig["environment.output.multi_in_array"]
if not self.multi_in_array:
self.multi_separator = self.rougailconfig["environment.output.multi_separator"]
self.submulti_separator = self.rougailconfig["environment.output.submulti_separator"]
ret = self.exporter()
if isinstance(self.dico, str):
value = self.dico
else:
value = "\n".join(self.dico.values()) + "\n"
return ret, value
def print(self) -> str:
ret, data = self.run()
print(data)
return ret
def exporter(self) -> None:
self.dico = {}
self.manage_warnings()
if not self.manage_errors():
return False
if not self.config.isoptiondescription():
name = self.get_name(self.config)
self.set_value(name, self.config.value.get())
return True
self.parse_family(
self.config,
)
return self.manage_errors()
def manage_warnings(self) -> None:
if not self.warnings:
return
warnings = []
for w in self.warnings:
if isinstance(w, dict):
msg, opt = next(iter(w.items()))
warnings.append(_("{0}: {1}").format(opt.path, msg))
else:
warnings.append(w)
self.set_value("_warnings", warnings)
def manage_errors(self) -> bool:
if not self.errors:
return True
errors = []
for e in self.errors:
if isinstance(e, dict):
msg, opt = next(iter(e.items()))
errors.append(_("{0}: {1}").format(opt.path, msg))
else:
errors.append(e)
self.set_value("_errors", errors)
return False
def parse_family(
self,
parent,
):
for child in parent:
if child.isoptiondescription():
if child.isleadership():
parse = self.parse_sequence
else:
parse = self.parse_family
parse(child)
else:
name = self.get_name(child)
self.set_value(name, child.value.get())
def get_name(self, child):
if self.path_is_variable_name:
name = child.path()
else:
name = child.name()
if self.upper:
name = name.upper()
if self.custom_separator:
name = name.replace(".", self.custom_separator)
if self.prefix:
name = self.prefix + name
return name
def set_value(self, name, values):
if name in self.dico:
raise ExtensionError(_('The variable name "{0}" is duplicated').format(name))
self.dico[name] = f'{name}={self.conv_values(name, values)}'
def conv_values(self, name, values):
if isinstance(values, list):
values = [self.conv_sub_values(name, value) for value in values]
if self.multi_in_array:
return f'({" ".join(values)})'
return self.multi_separator.join(values)
values = self.conv_to_string(values)
return quote(values)
def conv_sub_values(self, name, values):
if isinstance(values, list):
new_values = []
for value in values:
value = self.conv_to_string(value)
if self.submulti_separator in value:
raise ExtensionError(_('the character "{0}" is a sub multi separator, this character must not in the "{1}" value').format(self.submulti_separator, name))
new_values.append(value)
values = self.submulti_separator.join(new_values)
values = self.conv_to_string(values)
if not self.multi_in_array and self.multi_separator in values:
raise ExtensionError(_('the character "{0}" is a multi separator, this character must not in the "{1}" value').format(self.multi_separator, name))
return quote(values)
def conv_to_string(self, values):
if isinstance(values, bool):
values = self.booleans.get(values, values)
if isinstance(values, (int, float)):
values = str(values)
if values is None:
values = ""
return values
def parse_sequence(
self,
child,
):
leader, *followers = list(child)
leader_values = leader.value.get()
self.set_value(self.get_name(leader), leader_values)
followers_data = {}
followers_name = {}
for follower in list(followers):
follower_path = follower.path()
follower_name = followers_name.get(follower_path, None)
if not follower_name:
follower_name = self.get_name(follower)
followers_name[follower_path] = follower_name
followers_data.setdefault(follower_name, {})[follower.index()] = follower.value.get()
leader_len = len(leader_values)
for name, values in followers_data.items():
self.set_value(name, [values[idx] if idx in values else "" for idx in range(leader_len)])
RougailOutput = RougailOutputEnvironment
__all__ = ("RougailOutputEnvironment",)

View file

@ -0,0 +1,26 @@
"""Internationalisation utilities
Silique (https://www.silique.fr)
Copyright (C) 2026
This program is free software: you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as published by the
Free Software Foundation, either version 3 of the License, or (at your
option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
details.
You should have received a copy of the GNU Lesser General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
"""
from gettext import translation
from pathlib import Path
t = translation(
"rougail_output_environment", str(Path(__file__).parent / "locale"), fallback=True
)
_ = t.gettext

View file

@ -0,0 +1 @@

View file

@ -0,0 +1 @@

View file

@ -0,0 +1 @@

View file

@ -0,0 +1 @@

View file

@ -0,0 +1 @@
VERSION=string1

View file

@ -0,0 +1 @@
EMPTY=string1

View file

@ -0,0 +1,2 @@
VAR1=no
VAR2=(no)

View file

@ -0,0 +1,2 @@
VAR1=(no yes maybe)
VAR2=(no yes maybe)

View file

@ -0,0 +1 @@
VAR2=a_value

View file

@ -0,0 +1,2 @@
VAR1=(domain1.lan domain2.lan)
VAR2=(domain1.lan domain2.lan)

View file

@ -0,0 +1,2 @@
VAR1=string1
VAR2=string1

View file

@ -0,0 +1,3 @@
VAR1=string1
VAR2=string1
VAR3=string1

View file

@ -0,0 +1,2 @@
VAR1=(domain1.lan domain2.lan)
VAR2=(domain1.lan domain2.lan)

View file

@ -0,0 +1 @@
VAR1='My%Val;ue$#!1su:'

View file

@ -0,0 +1,2 @@
VAR1=string1
VAR2=string1

View file

@ -0,0 +1 @@
WITHOUT_TYPE=non

View file

@ -0,0 +1,6 @@
VAR1=true
VAR2=true
VAR3=true
VAR4=false
VAR5=false
VAR6=false

View file

@ -0,0 +1 @@
VARIABLE=true

View file

@ -0,0 +1,6 @@
VAR1=a
VAR2=a
VAR3=''
VAR4=''
VAR5=a
VAR6=1

View file

@ -0,0 +1 @@
VAR=9

View file

@ -0,0 +1,2 @@
VAR1=a
VAR2=a

View file

@ -0,0 +1,2 @@
VAR1=(a b c)
VAR2=a

View file

@ -0,0 +1,3 @@
VAR1=(a b c)
VAR2=a
VAR3=a

View file

@ -0,0 +1,3 @@
VAR1=(a b c)
VAR2=a
FAMILY_VAR3=a

View file

@ -0,0 +1,2 @@
CUSTOM1=string1
CUSTOM2=value

View file

@ -0,0 +1 @@
VARIABLE=my.domain.name

View file

@ -0,0 +1 @@
VARIABLE=my.domain.name

View file

@ -0,0 +1,6 @@
VAR1=0.0
VAR2=0.0
VAR3=0.0
VAR4=10.1
VAR5=10.1
VAR6=10.1

View file

@ -0,0 +1,6 @@
VAR1=0
VAR2=0
VAR3=0
VAR4=10
VAR5=10
VAR6=10

View file

@ -0,0 +1,3 @@
VAR1=1.1.1.1
VAR2=1.1.1.1/24
VAR3=1.1.1.1/24

View file

@ -0,0 +1,3 @@
VAR1=1.1.1.0
VAR2=1.1.1.0/24
VAR3=1.1.1.0/24

View file

@ -0,0 +1,6 @@
VAR1=0
VAR2=0
VAR3=0
VAR4=10
VAR5=10
VAR6=10

View file

@ -0,0 +1,3 @@
VARIABLE1=80
VARIABLE2=8080
VARIABLE3=8080

View file

@ -0,0 +1 @@
VAR='#a1a1a1'

View file

@ -0,0 +1,2 @@
VAR1='#a1a1a1'
VAR2='#a1a1a1'

View file

@ -0,0 +1,2 @@
SECRET1=onE7vaLues_len1
SECRET2=value

View file

@ -0,0 +1,3 @@
SECRET1=onE7vaLues_len1
SECRET2=value
SECRET3=value

View file

@ -0,0 +1,8 @@
VAR1=string1
VAR2=string1
VAR3=string1
VAR4=value
VAR5=value
VAR6=value
VAR7=8080
VAR8=true

View file

@ -0,0 +1 @@
VAR='quote'"'"''

View file

@ -0,0 +1,3 @@
VAR1=string1
VAR2=string1
VAR3=string1

View file

@ -0,0 +1,2 @@
VAR1=string1
VAR2=string1

View file

@ -0,0 +1,2 @@
VAR1=string1
VAR2=string1

View file

@ -0,0 +1 @@
VARIABLE='quote"'

View file

@ -0,0 +1 @@
VARIABLE='quote'"'"'"'

View file

@ -0,0 +1 @@
VARIABLE='quote\"\'"'"''

View file

@ -0,0 +1 @@
VARIABLE='quote'"'"''

View file

@ -0,0 +1 @@
VARIABLE=string1

View file

@ -0,0 +1,6 @@
VAR1=test
VAR2=value
VAR3=test1
VAR4=''
VAR5=true
VAR6=(test1 test2)

View file

@ -0,0 +1,2 @@
VARIABLE1=(val1 val2)
VARIABLE2=()

View file

@ -0,0 +1,3 @@
SOURCE_VARIABLE_1=val1
SOURCE_VARIABLE_2=val2
MY_VARIABLE=val1

View file

@ -0,0 +1 @@
VARIABLE=string_1_True_None

View file

@ -0,0 +1 @@
VAR=string1

View file

@ -0,0 +1,2 @@
VAR1=string1
VAR2=string1

View file

@ -0,0 +1,2 @@
MY_VARIABLE=val1
MY_CALCULATED_VARIABLE=(val1)

View file

@ -0,0 +1,2 @@
MY_VARIABLE=val1
MY_CALCULATED_VARIABLE=(val1)

View file

@ -0,0 +1,2 @@
MY_VARIABLE=val1
MY_CALCULATED_VARIABLE=(val1 value)

View file

@ -0,0 +1 @@
MY_CALCULATED_VARIABLE=(string1 string2 string3)

View file

@ -0,0 +1,2 @@
MY_VARIABLE=(val1 val2)
MY_CALCULATED_VARIABLE=(val1 val2)

View file

@ -0,0 +1,2 @@
VAR1=no
VAR2=no

View file

@ -0,0 +1,2 @@
VAR1=string1
VAR2=string1

View file

@ -0,0 +1,2 @@
VAR1=string1
VAR2=string1

View file

@ -0,0 +1 @@
VAR=9

View file

@ -0,0 +1 @@
VAR=9

View file

@ -0,0 +1,8 @@
VAR1=(true)
VAR2=(true)
VAR3=(true)
VAR4=(false)
VAR5=(false)
VAR6=(false)
VAR7=(true)
VAR8=(true)

View file

@ -0,0 +1,2 @@
CUSTOM1=(string1 string2 string3)
CUSTOM2=(value)

View file

@ -0,0 +1,8 @@
VAR1=(0.0)
VAR2=(0.0)
VAR3=(0.0)
VAR4=(10.1)
VAR5=(10.1)
VAR6=(10.1)
VAR7=(0.0)
VAR8=(0.0)

View file

@ -0,0 +1,8 @@
VAR1=(0)
VAR2=(0)
VAR3=(0)
VAR4=(10)
VAR5=(10)
VAR6=(10)
VAR7=(0)
VAR8=(0)

View file

@ -0,0 +1 @@
VAR=(1 2 3)

View file

@ -0,0 +1 @@
VAR1=(value '')

View file

@ -0,0 +1,8 @@
VAR1=(string1 string2 string3)
VAR2=(string1 string2 string3)
VAR3=(string1 string2 string3)
VAR4=(value)
VAR5=(value)
VAR6=(value)
VAR7=(value)
VAR8=(value)

View file

@ -0,0 +1,2 @@
VAR1=(val1 val2 val3)
VAR2=(val4 val5)

View file

@ -0,0 +1 @@
VARIABLE=('quote"')

View file

@ -0,0 +1 @@
VARIABLE=('quote'"'"'"')

View file

@ -0,0 +1 @@
VARIABLE=('quote'"'"'')

View file

@ -0,0 +1 @@
VARIABLE=(string1 string2 string3)

View file

@ -0,0 +1,2 @@
VARIABLE1=(a b c)
VARIABLE2=a

View file

@ -0,0 +1 @@
VARIABLE=c

View file

@ -0,0 +1,2 @@
VAR1=string1
VAR2=string1

View file

@ -0,0 +1 @@
INT=10

View file

@ -0,0 +1 @@
INT=10

View file

@ -0,0 +1 @@
VARIABLE=no

View file

@ -0,0 +1,2 @@
VAR1=no
VAR2=no

Some files were not shown because too many files have changed in this diff Show more