Compare commits

...

2 commits

Author SHA1 Message Date
7fb265b55c bump: version 0.2.0a10 → 0.2.0a11 2025-05-12 09:11:43 +02:00
603bcc33b0 fix: black 2025-05-11 19:13:56 +02:00
6 changed files with 70 additions and 40 deletions

View file

@ -1,3 +1,13 @@
## 0.2.0a11 (2025-05-12)
### Feat
- display loaded_from informations
### Fix
- black
## 0.2.0a10 (2025-05-09)
### Fix

View file

@ -5,7 +5,7 @@
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"POT-Creation-Date: 2025-05-11 10:20+0200\n"
"POT-Creation-Date: 2025-05-12 08:39+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"
@ -19,64 +19,64 @@ msgstr ""
msgid "Error in config: {0}"
msgstr ""
#: src/rougail/output_console/__init__.py:99
#: src/rougail/output_console/__init__.py:100
msgid "The following variables are mandatory but have no value:"
msgstr ""
#: src/rougail/output_console/__init__.py:103
#: src/rougail/output_console/__init__.py:105
msgid "The following variables are inaccessible but are empty and mandatory:"
msgstr ""
#: src/rougail/output_console/__init__.py:188
#: src/rougail/output_console/__init__.py:192
msgid "Variable"
msgstr ""
#: src/rougail/output_console/__init__.py:190
#: src/rougail/output_console/__init__.py:194
msgid "Undocumented variable"
msgstr ""
#: src/rougail/output_console/__init__.py:192
#: src/rougail/output_console/__init__.py:196
msgid "Undocumented but modified variable"
msgstr ""
#: src/rougail/output_console/__init__.py:194
#: src/rougail/output_console/__init__.py:198
msgid "Unmodifiable variable"
msgstr ""
#: src/rougail/output_console/__init__.py:197
#: src/rougail/output_console/__init__.py:201
msgid "Default value"
msgstr ""
#: src/rougail/output_console/__init__.py:199
#: src/rougail/output_console/__init__.py:203
msgid "Modified value"
msgstr ""
#: src/rougail/output_console/__init__.py:201
#: src/rougail/output_console/__init__.py:205
msgid "Original default value"
msgstr ""
#: src/rougail/output_console/__init__.py:205
#: src/rougail/output_console/__init__.py:209
msgid "Caption"
msgstr ""
#: src/rougail/output_console/__init__.py:212
#: src/rougail/output_console/__init__.py:216
msgid "ERRORS"
msgstr ""
#: src/rougail/output_console/__init__.py:227
#: src/rougail/output_console/__init__.py:232
msgid "WARNINGS"
msgstr ""
#: src/rougail/output_console/__init__.py:238
#: src/rougail/output_console/__init__.py:243
msgid "Variables:"
msgstr ""
#: src/rougail/output_console/__init__.py:261
#: src/rougail/output_console/__init__.py:379
#: src/rougail/output_console/__init__.py:274
#: src/rougail/output_console/__init__.py:394
msgid "{0}:"
msgstr ""
#: src/rougail/output_console/__init__.py:385
#: src/rougail/output_console/__init__.py:400
msgid "{0}: {1}"
msgstr ""

View file

@ -4,7 +4,7 @@ requires = ["flit_core >=3.8.0,<4"]
[project]
name = "rougail.output_console"
version = "0.2.0a10"
version = "0.2.0a11"
authors = [{name = "Emmanuel Garette", email = "gnunux@gnunux.info"}]
readme = "README.md"
description = "Rougail output console"

View file

@ -96,7 +96,9 @@ class RougailOutputConsole:
except PropertiesOptionError:
options_with_error.append(option)
if options:
self.errors.append(_("The following variables are mandatory but have no value:"))
self.errors.append(
_("The following variables are mandatory but have no value:")
)
self.errors.append(options)
elif options_with_error:
self.errors.append(
@ -120,13 +122,15 @@ class RougailOutputConsole:
if errors:
self.display_errors(errors)
return False
old_path_in_description = self.config.information.get('path_in_description', True)
self.config.information.set('path_in_description', False)
old_path_in_description = self.config.information.get(
"path_in_description", True
)
self.config.information.set("path_in_description", False)
self.parse_options(
self.config,
self.root,
)
self.config.information.set('path_in_description', old_path_in_description)
self.config.information.set("path_in_description", old_path_in_description)
self.header()
self.end()
return True
@ -183,20 +187,20 @@ class RougailOutputConsole:
leader_obj.add_variable(follower)
def header(self):
header_variable = ''
header_variable = ""
if self.variable_default_enable:
header_variable += _('Variable') + '\n'
header_variable += _("Variable") + "\n"
if self.variable_advanced_enable:
header_variable += f'[{self.variable_advanced_color}]{_("Undocumented variable")}[/{self.variable_advanced_color}]\n'
if self.variable_advanced_and_modified_enable:
header_variable += f'[{self.variable_advanced_and_modified_color}]{_("Undocumented but modified variable")}[/{self.variable_advanced_and_modified_color}]\n'
if self.variable_hidden_enable:
header_variable += f'[{self.variable_hidden_color}]{_("Unmodifiable variable")}[/{self.variable_hidden_color}]\n'
header_value = ''
header_value = ""
if self.value_unmodified_enable:
header_value = f'[{self.value_unmodified_color}]{_("Default value")}[/{self.value_unmodified_color}]\n'
if self.value_modified_enable:
header_value += _("Modified value") + '\n'
header_value += _("Modified value") + "\n"
if self.value_default_enable:
header_value += f'([{self.value_default_color}]{_("Original default value")}[/{self.value_default_color}])\n'
header = Table.grid(padding=1, collapse_padding=True)
@ -224,7 +228,8 @@ class RougailOutputConsole:
self,
warnings: list,
) -> None:
tree = Tree(f"[bold][bright_yellow]:bell: {_('WARNINGS')}[/bright_yellow][/bold]",
tree = Tree(
f"[bold][bright_yellow]:bell: {_('WARNINGS')}[/bright_yellow][/bold]",
guide_style="bold bright_yellow",
)
for warning in warnings:
@ -250,7 +255,15 @@ class RougailOutputConsole:
class OutputFamily:
def __init__(
self, family, parent, root, _yaml, key_is_description, *, is_leader: bool = False, no_icon: bool = False
self,
family,
parent,
root,
_yaml,
key_is_description,
*,
is_leader: bool = False,
no_icon: bool = False,
) -> None:
if parent is None:
tree = Tree
@ -258,7 +271,7 @@ class OutputFamily:
tree = parent.add
if is_leader:
self.tree = tree(
":notebook: " + _('{0}:').format(family),
":notebook: " + _("{0}:").format(family),
guide_style="bold bright_blue",
)
elif no_icon:
@ -349,9 +362,11 @@ class OutputFamily:
default_value = None
follower_index = option.index()
if follower_index is not None:
loaded_from = option.information.get(f'loaded_from_{follower_index}', None)
loaded_from = option.information.get(
f"loaded_from_{follower_index}", None
)
else:
loaded_from = option.information.get('loaded_from', None)
loaded_from = option.information.get("loaded_from", None)
if variable_color is None:
self.root.variable_default_enable = True
if value is undefined:
@ -376,7 +391,7 @@ class OutputFamily:
)
if isinstance(value, list):
subtree = self.tree.add(
":notebook: " + _('{0}:').format(key),
":notebook: " + _("{0}:").format(key),
guide_style="bold bright_blue",
)
for val in value:
@ -420,7 +435,7 @@ class OutputFamily:
)
return ret
if value is None:
ret = ''
ret = ""
else:
if option:
value = self.convert_value(
@ -431,7 +446,10 @@ class OutputFamily:
ret = f"[{color}]{value}[/{color}]"
else:
ret = value
if default_value is not None and "force_store_value" not in option.property.get():
if (
default_value is not None
and "force_store_value" not in option.property.get()
):
self.root.value_default_enable = True
default_value_color = self.root.value_default_color
default_value = self.convert_value(option, default_value)
@ -443,9 +461,9 @@ class OutputFamily:
else:
ret = f"[{default_value_color}]{default_value}[/{default_value_color}]"
if loaded_from:
ret += f' ({loaded_from})'
ret += f" ({loaded_from})"
elif loaded_from:
ret += f' ({loaded_from})'
ret += f" ({loaded_from})"
return ret
def convert_value(
@ -455,7 +473,7 @@ class OutputFamily:
) -> str:
if isinstance(value, list):
print(value)
raise Exception('pfff')
raise Exception("pfff")
"""Dump variable, means transform bool, ... to yaml string"""
if not self.root.show_secrets and option.type() == "password":
return "*" * 10

View file

@ -1 +1 @@
__version__ = "0.2.0a10"
__version__ = "0.2.0a11"

View file

@ -19,6 +19,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
from gettext import translation
from pathlib import Path
t = translation("rougail_output_console", str(Path(__file__).parent / "locale"), fallback=True)
t = translation(
"rougail_output_console", str(Path(__file__).parent / "locale"), fallback=True
)
_ = t.gettext