Compare commits
3 commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 8305cb6693 | |||
| e07cf94846 | |||
| d21fff4f7e |
6 changed files with 47 additions and 48 deletions
21
CHANGELOG.md
21
CHANGELOG.md
|
|
@ -1,19 +1,12 @@
|
|||
## 0.1.0a3 (2026-06-11)
|
||||
|
||||
### Fix
|
||||
|
||||
- without namespace
|
||||
|
||||
## 0.1.0a2 (2026-01-01)
|
||||
## 0.1.0 (2026-06-21)
|
||||
|
||||
### Feat
|
||||
|
||||
- github: enter in table is <br/>
|
||||
|
||||
## 0.1.0a1 (2025-12-22)
|
||||
|
||||
## 0.1.0a0 (2025-12-21)
|
||||
|
||||
### Feat
|
||||
|
||||
- first version
|
||||
|
||||
### Fix
|
||||
|
||||
- rougail dependencies
|
||||
- black
|
||||
- without namespace
|
||||
|
|
|
|||
16
README.fr.md
16
README.fr.md
|
|
@ -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.\
|
||||
> **Chemin** : table\
|
||||
> *`désactivé`*\
|
||||
> **Désactivé** : si table n'est pas mis dans "[Sélection pour sortie](#step.output)"
|
||||
|
||||
| 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/>• description<br/>• 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.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/>• console<br/>• github<br/>• asciidoc<br/>• html<br/>• rst |
|
||||
| **<a id="table.header" name="table.header">table.header</a>**<br/>**Ligne de commande** : <br/>• --table.header<br/>• --table.no-header<br/>**Variable d'environnement** : TABLE.HEADER | Ajouter l'entête dans le tableau. | true | [`boolean`](https://rougail.readthedocs.io/en/latest/variable.html#variables-types) `obligatoire` | |
|
||||
|
||||
> **Désactivé** : si table n'est pas mis dans "[sélection pour sortie](#step.output)".
|
||||
|
||||
| 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** : <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/>• description<br/>• namespace |
|
||||
| **<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** : <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/>• console<br/>• github<br/>• asciidoc<br/>• html<br/>• rst |
|
||||
| **<a id="table.header" name="table.header">table.header</a>**<br/>**Ligne de commande** : <br/>• --table.header<br/>• --table.no-header<br/>**Variable d'environnement** : ROUGAILCLI_TABLE.HEADER | Ajouter l'entête dans le tableau. | true | [`boolean`](https://rougail.readthedocs.io/en/latest/variable.html#variables-types) `obligatoire` | |
|
||||
|
|
|
|||
16
README.md
16
README.md
|
|
@ -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.\
|
||||
> **Path**: table\
|
||||
> *`disabled`*\
|
||||
> **Disabled**: if table is not set in "[Select for output](#step.output)"
|
||||
|
||||
| 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/>• description<br/>• 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.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/>• console<br/>• github<br/>• asciidoc<br/>• html<br/>• rst |
|
||||
| **<a id="table.header" name="table.header">table.header</a>**<br/>**Command line**: <br/>• --table.header<br/>• --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` | |
|
||||
|
||||
> **Disabled**: if table is not set in "[select for output](#step.output)".
|
||||
|
||||
| Variable | Description | Default value | Type | Validator |
|
||||
|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------|
|
||||
| **<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/>• description<br/>• namespace |
|
||||
| **<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**: <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/>• console<br/>• github<br/>• asciidoc<br/>• html<br/>• rst |
|
||||
| **<a id="table.header" name="table.header">table.header</a>**<br/>**Command line**: <br/>• --table.header<br/>• --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` | |
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ requires = ["flit_core >=3.8.0,<4"]
|
|||
|
||||
[project]
|
||||
name = "rougail.output_table"
|
||||
version = "0.1.0rc0"
|
||||
version = "0.1.0"
|
||||
authors = [{name = "Emmanuel Garette", email = "gnunux@gnunux.info"}]
|
||||
readme = "README.md"
|
||||
description = "Rougail output table"
|
||||
|
|
@ -24,8 +24,8 @@ classifiers = [
|
|||
|
||||
]
|
||||
dependencies = [
|
||||
"rougail-base > 1.1,<2",
|
||||
"tabulate ~= 0.9.0",
|
||||
"rougail-base >= 1.2.0,<2",
|
||||
"tabulate ~= 0.10.0",
|
||||
]
|
||||
|
||||
[project.urls]
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
"""
|
||||
Silique (https://www.silique.fr)
|
||||
Copyright (C) 2022-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
|
||||
|
|
@ -28,10 +28,11 @@ from .i18n import _
|
|||
from .__version__ import __version__
|
||||
|
||||
|
||||
TABULATE = {"console": "heavy_grid",
|
||||
"html": "unsafehtml",
|
||||
}
|
||||
ENTER = {"github": '<br/>'}
|
||||
TABULATE = {
|
||||
"console": "heavy_grid",
|
||||
"html": "unsafehtml",
|
||||
}
|
||||
ENTER = {"github": "<br/>"}
|
||||
|
||||
|
||||
class RougailOutputTable:
|
||||
|
|
@ -75,13 +76,17 @@ class RougailOutputTable:
|
|||
self.output_format = TABULATE[self.output_format]
|
||||
self.columns = self.rougailconfig["table.columns"].copy()
|
||||
self.first_column = self.rougailconfig["table.first_column"]
|
||||
if self.first_column == 'namespace':
|
||||
if self.first_column == "namespace":
|
||||
if self.support_namespace:
|
||||
self.columns.insert(0, 'namespace')
|
||||
self.columns.insert(0, "namespace")
|
||||
else:
|
||||
self.columns.insert(0, 'description')
|
||||
self.columns.insert(0, "description")
|
||||
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()
|
||||
else:
|
||||
namespace = ""
|
||||
|
|
@ -122,20 +127,24 @@ class RougailOutputTable:
|
|||
def manage(self, option, namespace):
|
||||
if option.isoptiondescription():
|
||||
self.walk(option, namespace)
|
||||
tags = option.information.get('tags', [])
|
||||
tags = option.information.get("tags", [])
|
||||
if not tags:
|
||||
return
|
||||
for col in self.columns:
|
||||
if col in tags:
|
||||
value = option.value.get()
|
||||
if self.first_column == 'namespace':
|
||||
if self.first_column == "namespace":
|
||||
key = namespace
|
||||
else:
|
||||
key = option.description()
|
||||
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:
|
||||
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]
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -76,4 +76,5 @@ table:
|
|||
"level": 60,
|
||||
}
|
||||
|
||||
|
||||
__all__ = ("get_rougail_config",)
|
||||
|
|
|
|||
Loading…
Reference in a new issue