Compare commits

...

3 commits

Author SHA1 Message Date
8305cb6693 bump: version 0.1.0rc0 → 0.1.0 2026-06-21 18:34:08 +02:00
e07cf94846 fix: rougail dependencies 2026-06-21 18:34:00 +02:00
d21fff4f7e fix: black 2026-06-21 17:06:52 +02:00
6 changed files with 47 additions and 48 deletions

View file

@ -1,19 +1,12 @@
## 0.1.0a3 (2026-06-11) ## 0.1.0 (2026-06-21)
### Fix
- without namespace
## 0.1.0a2 (2026-01-01)
### Feat ### Feat
- github: enter in table is <br/> - github: enter in table is <br/>
## 0.1.0a1 (2025-12-22)
## 0.1.0a0 (2025-12-21)
### Feat
- first version - first version
### Fix
- rougail dependencies
- black
- without namespace

View file

@ -11,13 +11,11 @@ include_toc: true
> L'objectif n'est pas d'afficher toutes les variables de la configuration, mais seulement une sélection à l'aide du mécanisme d'étiquetage.\ > L'objectif n'est pas d'afficher toutes les variables de la configuration, mais seulement une sélection à l'aide du mécanisme d'étiquetage.\
> **Chemin** : table\ > **Chemin** : table\
> *`désactivé`*\ > *`désactivé`*\
> **Désactivé** : si table n'est pas mis dans "[Sélection pour sortie](#step.output)" > **Désactivé** : si table n'est pas mis dans "[sélection pour sortie](#step.output)".
| Variable | Description | Valeur par défaut | Type | Validateur | | Variable | Description | Valeur par défaut | Type | Validateur |
|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------| |--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------|
| **<a id="table.first_column" name="table.first_column">table.first_column</a>**<br/>**Ligne de commande** : --table.first_column<br/>**Variable d'environnement** : TABLE.FIRST_COLUMN | Contenu de la première colonne. | La première colonne est description si "[Noms des étiquettes](#table.columns)" n'a qu'une valeur, sinon c'est namespace | [`choice`](https://rougail.readthedocs.io/en/latest/variable.html#variables-types) `obligatoire` | Le nom de l'étiquette ne doit pas avoir le même nom que la première colonne.<br/>**Choix** : <br/>&nbsp;description<br/>&nbsp;namespace | | **<a id="table.first_column" name="table.first_column">table.first_column</a>**<br/>**Ligne de commande** : <br/>--table.first_column<br/>**Variable d'environnement** : ROUGAILCLI_TABLE.FIRST_COLUMN | Contenu de la première colonne. | La première colonne est description si "[Noms des étiquettes](#table.columns)" n'a qu'une valeur, sinon c'est namespace. | [`choice`](https://rougail.readthedocs.io/en/latest/variable.html#variables-types) `obligatoire` | Le nom de l'étiquette ne doit pas avoir le même nom que la première colonne.<br/>**Choix** : <br/>&nbsp;description<br/>&nbsp;namespace |
| **<a id="table.columns" name="table.columns">table.columns</a>**<br/>**Ligne de commande** : --table.columns<br/>**Variable d'environnement** : TABLE.COLUMNS | Noms des étiquettes.<br/>Chaque étiquette créée une colonne. Le contenu des colonnes viennent des variables avec les étiquettes définis. | | [`string`](https://rougail.readthedocs.io/en/latest/variable.html#variables-types) `multiple` `obligatoire` | `unique` | | **<a id="table.columns" name="table.columns">table.columns</a>**<br/>**Ligne de commande** : <br/>--table.columns<br/>**Variable d'environnement** : ROUGAILCLI_TABLE.COLUMNS | Noms des étiquettes.<br/>Chaque étiquette créée une colonne. Le contenu des colonnes viennent des variables avec les étiquettes définis. | | [`string`](https://rougail.readthedocs.io/en/latest/variable.html#variables-types) `multiple` `obligatoire` | `unique` |
| **<a id="table.output_format" name="table.output_format">table.output_format</a>**<br/>**Ligne de commande** : --table.output_format<br/>**Variable d'environnement** : TABLE.OUTPUT_FORMAT | Noms des étiquettes. | console | [`choice`](https://rougail.readthedocs.io/en/latest/variable.html#variables-types) `obligatoire` | **Choix** : <br/>&nbsp;console<br/>&nbsp;github<br/>&nbsp;asciidoc<br/>&nbsp;html<br/>&nbsp;rst | | **<a id="table.output_format" name="table.output_format">table.output_format</a>**<br/>**Ligne de commande** : <br/>--table.output_format<br/>**Variable d'environnement** : ROUGAILCLI_TABLE.OUTPUT_FORMAT | Noms des étiquettes. | console | [`choice`](https://rougail.readthedocs.io/en/latest/variable.html#variables-types) `obligatoire` | **Choix** : <br/>&nbsp;console<br/>&nbsp;github<br/>&nbsp;asciidoc<br/>&nbsp;html<br/>&nbsp;rst |
| **<a id="table.header" name="table.header">table.header</a>**<br/>**Ligne de commande** : <br/>&nbsp;--table.header<br/>&nbsp;--table.no-header<br/>**Variable d'environnement** : TABLE.HEADER | Ajouter l&#x27;entête dans le tableau. | true | [`boolean`](https://rougail.readthedocs.io/en/latest/variable.html#variables-types) `obligatoire` | | | **<a id="table.header" name="table.header">table.header</a>**<br/>**Ligne de commande** : <br/>&nbsp;--table.header<br/>&nbsp;--table.no-header<br/>**Variable d'environnement** : ROUGAILCLI_TABLE.HEADER | Ajouter l&#x27;entête dans le tableau. | true | [`boolean`](https://rougail.readthedocs.io/en/latest/variable.html#variables-types) `obligatoire` | |

View file

@ -11,13 +11,11 @@ include_toc: true
> The goal is not to display all the variables in the configuration, but only a selection using the labeling mechanism.\ > The goal is not to display all the variables in the configuration, but only a selection using the labeling mechanism.\
> **Path**: table\ > **Path**: table\
> *`disabled`*\ > *`disabled`*\
> **Disabled**: if table is not set in "[Select for output](#step.output)" > **Disabled**: if table is not set in "[select for output](#step.output)".
| Variable | Description | Default value | Type | Validator | | Variable | Description | Default value | Type | Validator |
|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------| |---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------|
| **<a id="table.first_column" name="table.first_column">table.first_column</a>**<br/>**Command line**: --table.first_column<br/>**Environment variable**: TABLE.FIRST_COLUMN | Content of the first column. | First column is description if "[Tag names](#table.columns)" has only one value, otherwise it's namespace | [`choice`](https://rougail.readthedocs.io/en/latest/variable.html#variables-types) `mandatory` | Tag name must not have the same name has first column.<br/>**Choices**: <br/>&nbsp;description<br/>&nbsp;namespace | | **<a id="table.first_column" name="table.first_column">table.first_column</a>**<br/>**Command line**: <br/>--table.first_column<br/>**Environment variable**: ROUGAILCLI_TABLE.FIRST_COLUMN | Content of the first column. | First column is description if "[Tag names](#table.columns)" has only one value, otherwise it's namespace. | [`choice`](https://rougail.readthedocs.io/en/latest/variable.html#variables-types) `mandatory` | Tag name must not have the same name has first column.<br/>**Choices**: <br/>&nbsp;description<br/>&nbsp;namespace |
| **<a id="table.columns" name="table.columns">table.columns</a>**<br/>**Command line**: --table.columns<br/>**Environment variable**: TABLE.COLUMNS | Tag names.<br/>Each tag creates a column. The content of the columns comes from the variables with the defined tags. | | [`string`](https://rougail.readthedocs.io/en/latest/variable.html#variables-types) `multiple` `mandatory` | `unique` | | **<a id="table.columns" name="table.columns">table.columns</a>**<br/>**Command line**: <br/>--table.columns<br/>**Environment variable**: ROUGAILCLI_TABLE.COLUMNS | Tag names.<br/>Each tag creates a column. The content of the columns comes from the variables with the defined tags. | | [`string`](https://rougail.readthedocs.io/en/latest/variable.html#variables-types) `multiple` `mandatory` | `unique` |
| **<a id="table.output_format" name="table.output_format">table.output_format</a>**<br/>**Command line**: --table.output_format<br/>**Environment variable**: TABLE.OUTPUT_FORMAT | Tag names. | console | [`choice`](https://rougail.readthedocs.io/en/latest/variable.html#variables-types) `mandatory` | **Choices**: <br/>&nbsp;console<br/>&nbsp;github<br/>&nbsp;asciidoc<br/>&nbsp;html<br/>&nbsp;rst | | **<a id="table.output_format" name="table.output_format">table.output_format</a>**<br/>**Command line**: <br/>--table.output_format<br/>**Environment variable**: ROUGAILCLI_TABLE.OUTPUT_FORMAT | Tag names. | console | [`choice`](https://rougail.readthedocs.io/en/latest/variable.html#variables-types) `mandatory` | **Choices**: <br/>&nbsp;console<br/>&nbsp;github<br/>&nbsp;asciidoc<br/>&nbsp;html<br/>&nbsp;rst |
| **<a id="table.header" name="table.header">table.header</a>**<br/>**Command line**: <br/>&nbsp;--table.header<br/>&nbsp;--table.no-header<br/>**Environment variable**: TABLE.HEADER | Add header in table. | true | [`boolean`](https://rougail.readthedocs.io/en/latest/variable.html#variables-types) `mandatory` | | | **<a id="table.header" name="table.header">table.header</a>**<br/>**Command line**: <br/>&nbsp;--table.header<br/>&nbsp;--table.no-header<br/>**Environment variable**: ROUGAILCLI_TABLE.HEADER | Add header in table. | true | [`boolean`](https://rougail.readthedocs.io/en/latest/variable.html#variables-types) `mandatory` | |

View file

@ -4,7 +4,7 @@ requires = ["flit_core >=3.8.0,<4"]
[project] [project]
name = "rougail.output_table" name = "rougail.output_table"
version = "0.1.0rc0" version = "0.1.0"
authors = [{name = "Emmanuel Garette", email = "gnunux@gnunux.info"}] authors = [{name = "Emmanuel Garette", email = "gnunux@gnunux.info"}]
readme = "README.md" readme = "README.md"
description = "Rougail output table" description = "Rougail output table"
@ -24,8 +24,8 @@ classifiers = [
] ]
dependencies = [ dependencies = [
"rougail-base > 1.1,<2", "rougail-base >= 1.2.0,<2",
"tabulate ~= 0.9.0", "tabulate ~= 0.10.0",
] ]
[project.urls] [project.urls]

View file

@ -28,10 +28,11 @@ from .i18n import _
from .__version__ import __version__ from .__version__ import __version__
TABULATE = {"console": "heavy_grid", TABULATE = {
"console": "heavy_grid",
"html": "unsafehtml", "html": "unsafehtml",
} }
ENTER = {"github": '<br/>'} ENTER = {"github": "<br/>"}
class RougailOutputTable: class RougailOutputTable:
@ -75,13 +76,17 @@ class RougailOutputTable:
self.output_format = TABULATE[self.output_format] self.output_format = TABULATE[self.output_format]
self.columns = self.rougailconfig["table.columns"].copy() self.columns = self.rougailconfig["table.columns"].copy()
self.first_column = self.rougailconfig["table.first_column"] self.first_column = self.rougailconfig["table.first_column"]
if self.first_column == 'namespace': if self.first_column == "namespace":
if self.support_namespace: if self.support_namespace:
self.columns.insert(0, 'namespace') self.columns.insert(0, "namespace")
else: else:
self.columns.insert(0, 'description') self.columns.insert(0, "description")
for option in self.config: for option in self.config:
if self.support_namespace and self.first_column == 'namespace' and option.group_type() is groups.namespace: if (
self.support_namespace
and self.first_column == "namespace"
and option.group_type() is groups.namespace
):
namespace = option.description() namespace = option.description()
else: else:
namespace = "" namespace = ""
@ -122,20 +127,24 @@ class RougailOutputTable:
def manage(self, option, namespace): def manage(self, option, namespace):
if option.isoptiondescription(): if option.isoptiondescription():
self.walk(option, namespace) self.walk(option, namespace)
tags = option.information.get('tags', []) tags = option.information.get("tags", [])
if not tags: if not tags:
return return
for col in self.columns: for col in self.columns:
if col in tags: if col in tags:
value = option.value.get() value = option.value.get()
if self.first_column == 'namespace': if self.first_column == "namespace":
key = namespace key = namespace
else: else:
key = option.description() key = option.description()
if isinstance(value, list): if isinstance(value, list):
self.datas.setdefault(key, {}).setdefault(col, []).extend([str(val) for val in value]) self.datas.setdefault(key, {}).setdefault(col, []).extend(
[str(val) for val in value]
)
else: else:
self.datas.setdefault(key, {}).setdefault(col, []).append(str(value)) self.datas.setdefault(key, {}).setdefault(col, []).append(
str(value)
)
self.datas[key][self.first_column] = [key] self.datas[key][self.first_column] = [key]

View file

@ -76,4 +76,5 @@ table:
"level": 60, "level": 60,
} }
__all__ = ("get_rougail_config",) __all__ = ("get_rougail_config",)