Compare commits

..

No commits in common. "7fb265b55c07483982e04830fd4d83c33122dbc2" and "6556c308bf724d665d4c729d191082f3900eca53" have entirely different histories.

6 changed files with 40 additions and 70 deletions

View file

@ -1,13 +1,3 @@
## 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-12 08:39+0200\n"
"POT-Creation-Date: 2025-05-11 10:20+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:100
#: src/rougail/output_console/__init__.py:99
msgid "The following variables are mandatory but have no value:"
msgstr ""
#: src/rougail/output_console/__init__.py:105
#: src/rougail/output_console/__init__.py:103
msgid "The following variables are inaccessible but are empty and mandatory:"
msgstr ""
#: src/rougail/output_console/__init__.py:192
#: src/rougail/output_console/__init__.py:188
msgid "Variable"
msgstr ""
#: src/rougail/output_console/__init__.py:194
#: src/rougail/output_console/__init__.py:190
msgid "Undocumented variable"
msgstr ""
#: src/rougail/output_console/__init__.py:196
#: src/rougail/output_console/__init__.py:192
msgid "Undocumented but modified variable"
msgstr ""
#: src/rougail/output_console/__init__.py:198
#: src/rougail/output_console/__init__.py:194
msgid "Unmodifiable variable"
msgstr ""
#: src/rougail/output_console/__init__.py:201
#: src/rougail/output_console/__init__.py:197
msgid "Default value"
msgstr ""
#: src/rougail/output_console/__init__.py:203
#: src/rougail/output_console/__init__.py:199
msgid "Modified value"
msgstr ""
#: src/rougail/output_console/__init__.py:205
#: src/rougail/output_console/__init__.py:201
msgid "Original default value"
msgstr ""
#: src/rougail/output_console/__init__.py:209
#: src/rougail/output_console/__init__.py:205
msgid "Caption"
msgstr ""
#: src/rougail/output_console/__init__.py:216
#: src/rougail/output_console/__init__.py:212
msgid "ERRORS"
msgstr ""
#: src/rougail/output_console/__init__.py:232
#: src/rougail/output_console/__init__.py:227
msgid "WARNINGS"
msgstr ""
#: src/rougail/output_console/__init__.py:243
#: src/rougail/output_console/__init__.py:238
msgid "Variables:"
msgstr ""
#: src/rougail/output_console/__init__.py:274
#: src/rougail/output_console/__init__.py:394
#: src/rougail/output_console/__init__.py:261
#: src/rougail/output_console/__init__.py:379
msgid "{0}:"
msgstr ""
#: src/rougail/output_console/__init__.py:400
#: src/rougail/output_console/__init__.py:385
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.0a11"
version = "0.2.0a10"
authors = [{name = "Emmanuel Garette", email = "gnunux@gnunux.info"}]
readme = "README.md"
description = "Rougail output console"

View file

@ -96,9 +96,7 @@ 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(
@ -122,15 +120,13 @@ 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
@ -187,20 +183,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)
@ -228,8 +224,7 @@ 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:
@ -255,15 +250,7 @@ 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
@ -271,7 +258,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:
@ -362,11 +349,9 @@ 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:
@ -391,7 +376,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:
@ -435,7 +420,7 @@ class OutputFamily:
)
return ret
if value is None:
ret = ""
ret = ''
else:
if option:
value = self.convert_value(
@ -446,10 +431,7 @@ 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)
@ -461,9 +443,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(
@ -473,7 +455,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.0a11"
__version__ = "0.2.0a10"

View file

@ -19,8 +19,6 @@ 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