Compare commits
No commits in common. "7fb265b55c07483982e04830fd4d83c33122dbc2" and "6556c308bf724d665d4c729d191082f3900eca53" have entirely different histories.
7fb265b55c
...
6556c308bf
6 changed files with 40 additions and 70 deletions
10
CHANGELOG.md
10
CHANGELOG.md
|
|
@ -1,13 +1,3 @@
|
||||||
## 0.2.0a11 (2025-05-12)
|
|
||||||
|
|
||||||
### Feat
|
|
||||||
|
|
||||||
- display loaded_from informations
|
|
||||||
|
|
||||||
### Fix
|
|
||||||
|
|
||||||
- black
|
|
||||||
|
|
||||||
## 0.2.0a10 (2025-05-09)
|
## 0.2.0a10 (2025-05-09)
|
||||||
|
|
||||||
### Fix
|
### Fix
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@
|
||||||
msgid ""
|
msgid ""
|
||||||
msgstr ""
|
msgstr ""
|
||||||
"Project-Id-Version: PACKAGE VERSION\n"
|
"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"
|
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||||
|
|
@ -19,64 +19,64 @@ msgstr ""
|
||||||
msgid "Error in config: {0}"
|
msgid "Error in config: {0}"
|
||||||
msgstr ""
|
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:"
|
msgid "The following variables are mandatory but have no value:"
|
||||||
msgstr ""
|
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:"
|
msgid "The following variables are inaccessible but are empty and mandatory:"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: src/rougail/output_console/__init__.py:192
|
#: src/rougail/output_console/__init__.py:188
|
||||||
msgid "Variable"
|
msgid "Variable"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: src/rougail/output_console/__init__.py:194
|
#: src/rougail/output_console/__init__.py:190
|
||||||
msgid "Undocumented variable"
|
msgid "Undocumented variable"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: src/rougail/output_console/__init__.py:196
|
#: src/rougail/output_console/__init__.py:192
|
||||||
msgid "Undocumented but modified variable"
|
msgid "Undocumented but modified variable"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: src/rougail/output_console/__init__.py:198
|
#: src/rougail/output_console/__init__.py:194
|
||||||
msgid "Unmodifiable variable"
|
msgid "Unmodifiable variable"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: src/rougail/output_console/__init__.py:201
|
#: src/rougail/output_console/__init__.py:197
|
||||||
msgid "Default value"
|
msgid "Default value"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: src/rougail/output_console/__init__.py:203
|
#: src/rougail/output_console/__init__.py:199
|
||||||
msgid "Modified value"
|
msgid "Modified value"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: src/rougail/output_console/__init__.py:205
|
#: src/rougail/output_console/__init__.py:201
|
||||||
msgid "Original default value"
|
msgid "Original default value"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: src/rougail/output_console/__init__.py:209
|
#: src/rougail/output_console/__init__.py:205
|
||||||
msgid "Caption"
|
msgid "Caption"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: src/rougail/output_console/__init__.py:216
|
#: src/rougail/output_console/__init__.py:212
|
||||||
msgid "ERRORS"
|
msgid "ERRORS"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: src/rougail/output_console/__init__.py:232
|
#: src/rougail/output_console/__init__.py:227
|
||||||
msgid "WARNINGS"
|
msgid "WARNINGS"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: src/rougail/output_console/__init__.py:243
|
#: src/rougail/output_console/__init__.py:238
|
||||||
msgid "Variables:"
|
msgid "Variables:"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: src/rougail/output_console/__init__.py:274
|
#: src/rougail/output_console/__init__.py:261
|
||||||
#: src/rougail/output_console/__init__.py:394
|
#: src/rougail/output_console/__init__.py:379
|
||||||
msgid "{0}:"
|
msgid "{0}:"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: src/rougail/output_console/__init__.py:400
|
#: src/rougail/output_console/__init__.py:385
|
||||||
msgid "{0}: {1}"
|
msgid "{0}: {1}"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ requires = ["flit_core >=3.8.0,<4"]
|
||||||
|
|
||||||
[project]
|
[project]
|
||||||
name = "rougail.output_console"
|
name = "rougail.output_console"
|
||||||
version = "0.2.0a11"
|
version = "0.2.0a10"
|
||||||
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 console"
|
description = "Rougail output console"
|
||||||
|
|
|
||||||
|
|
@ -96,9 +96,7 @@ class RougailOutputConsole:
|
||||||
except PropertiesOptionError:
|
except PropertiesOptionError:
|
||||||
options_with_error.append(option)
|
options_with_error.append(option)
|
||||||
if options:
|
if options:
|
||||||
self.errors.append(
|
self.errors.append(_("The following variables are mandatory but have no value:"))
|
||||||
_("The following variables are mandatory but have no value:")
|
|
||||||
)
|
|
||||||
self.errors.append(options)
|
self.errors.append(options)
|
||||||
elif options_with_error:
|
elif options_with_error:
|
||||||
self.errors.append(
|
self.errors.append(
|
||||||
|
|
@ -122,15 +120,13 @@ class RougailOutputConsole:
|
||||||
if errors:
|
if errors:
|
||||||
self.display_errors(errors)
|
self.display_errors(errors)
|
||||||
return False
|
return False
|
||||||
old_path_in_description = self.config.information.get(
|
old_path_in_description = self.config.information.get('path_in_description', True)
|
||||||
"path_in_description", True
|
self.config.information.set('path_in_description', False)
|
||||||
)
|
|
||||||
self.config.information.set("path_in_description", False)
|
|
||||||
self.parse_options(
|
self.parse_options(
|
||||||
self.config,
|
self.config,
|
||||||
self.root,
|
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.header()
|
||||||
self.end()
|
self.end()
|
||||||
return True
|
return True
|
||||||
|
|
@ -187,20 +183,20 @@ class RougailOutputConsole:
|
||||||
leader_obj.add_variable(follower)
|
leader_obj.add_variable(follower)
|
||||||
|
|
||||||
def header(self):
|
def header(self):
|
||||||
header_variable = ""
|
header_variable = ''
|
||||||
if self.variable_default_enable:
|
if self.variable_default_enable:
|
||||||
header_variable += _("Variable") + "\n"
|
header_variable += _('Variable') + '\n'
|
||||||
if self.variable_advanced_enable:
|
if self.variable_advanced_enable:
|
||||||
header_variable += f'[{self.variable_advanced_color}]{_("Undocumented variable")}[/{self.variable_advanced_color}]\n'
|
header_variable += f'[{self.variable_advanced_color}]{_("Undocumented variable")}[/{self.variable_advanced_color}]\n'
|
||||||
if self.variable_advanced_and_modified_enable:
|
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'
|
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:
|
if self.variable_hidden_enable:
|
||||||
header_variable += f'[{self.variable_hidden_color}]{_("Unmodifiable variable")}[/{self.variable_hidden_color}]\n'
|
header_variable += f'[{self.variable_hidden_color}]{_("Unmodifiable variable")}[/{self.variable_hidden_color}]\n'
|
||||||
header_value = ""
|
header_value = ''
|
||||||
if self.value_unmodified_enable:
|
if self.value_unmodified_enable:
|
||||||
header_value = f'[{self.value_unmodified_color}]{_("Default value")}[/{self.value_unmodified_color}]\n'
|
header_value = f'[{self.value_unmodified_color}]{_("Default value")}[/{self.value_unmodified_color}]\n'
|
||||||
if self.value_modified_enable:
|
if self.value_modified_enable:
|
||||||
header_value += _("Modified value") + "\n"
|
header_value += _("Modified value") + '\n'
|
||||||
if self.value_default_enable:
|
if self.value_default_enable:
|
||||||
header_value += f'([{self.value_default_color}]{_("Original default value")}[/{self.value_default_color}])\n'
|
header_value += f'([{self.value_default_color}]{_("Original default value")}[/{self.value_default_color}])\n'
|
||||||
header = Table.grid(padding=1, collapse_padding=True)
|
header = Table.grid(padding=1, collapse_padding=True)
|
||||||
|
|
@ -228,8 +224,7 @@ class RougailOutputConsole:
|
||||||
self,
|
self,
|
||||||
warnings: list,
|
warnings: list,
|
||||||
) -> None:
|
) -> None:
|
||||||
tree = Tree(
|
tree = Tree(f"[bold][bright_yellow]:bell: {_('WARNINGS')}[/bright_yellow][/bold]",
|
||||||
f"[bold][bright_yellow]:bell: {_('WARNINGS')}[/bright_yellow][/bold]",
|
|
||||||
guide_style="bold bright_yellow",
|
guide_style="bold bright_yellow",
|
||||||
)
|
)
|
||||||
for warning in warnings:
|
for warning in warnings:
|
||||||
|
|
@ -255,15 +250,7 @@ class RougailOutputConsole:
|
||||||
|
|
||||||
class OutputFamily:
|
class OutputFamily:
|
||||||
def __init__(
|
def __init__(
|
||||||
self,
|
self, family, parent, root, _yaml, key_is_description, *, is_leader: bool = False, no_icon: bool = False
|
||||||
family,
|
|
||||||
parent,
|
|
||||||
root,
|
|
||||||
_yaml,
|
|
||||||
key_is_description,
|
|
||||||
*,
|
|
||||||
is_leader: bool = False,
|
|
||||||
no_icon: bool = False,
|
|
||||||
) -> None:
|
) -> None:
|
||||||
if parent is None:
|
if parent is None:
|
||||||
tree = Tree
|
tree = Tree
|
||||||
|
|
@ -271,7 +258,7 @@ class OutputFamily:
|
||||||
tree = parent.add
|
tree = parent.add
|
||||||
if is_leader:
|
if is_leader:
|
||||||
self.tree = tree(
|
self.tree = tree(
|
||||||
":notebook: " + _("{0}:").format(family),
|
":notebook: " + _('{0}:').format(family),
|
||||||
guide_style="bold bright_blue",
|
guide_style="bold bright_blue",
|
||||||
)
|
)
|
||||||
elif no_icon:
|
elif no_icon:
|
||||||
|
|
@ -362,11 +349,9 @@ class OutputFamily:
|
||||||
default_value = None
|
default_value = None
|
||||||
follower_index = option.index()
|
follower_index = option.index()
|
||||||
if follower_index is not None:
|
if follower_index is not None:
|
||||||
loaded_from = option.information.get(
|
loaded_from = option.information.get(f'loaded_from_{follower_index}', None)
|
||||||
f"loaded_from_{follower_index}", None
|
|
||||||
)
|
|
||||||
else:
|
else:
|
||||||
loaded_from = option.information.get("loaded_from", None)
|
loaded_from = option.information.get('loaded_from', None)
|
||||||
if variable_color is None:
|
if variable_color is None:
|
||||||
self.root.variable_default_enable = True
|
self.root.variable_default_enable = True
|
||||||
if value is undefined:
|
if value is undefined:
|
||||||
|
|
@ -391,7 +376,7 @@ class OutputFamily:
|
||||||
)
|
)
|
||||||
if isinstance(value, list):
|
if isinstance(value, list):
|
||||||
subtree = self.tree.add(
|
subtree = self.tree.add(
|
||||||
":notebook: " + _("{0}:").format(key),
|
":notebook: " + _('{0}:').format(key),
|
||||||
guide_style="bold bright_blue",
|
guide_style="bold bright_blue",
|
||||||
)
|
)
|
||||||
for val in value:
|
for val in value:
|
||||||
|
|
@ -435,7 +420,7 @@ class OutputFamily:
|
||||||
)
|
)
|
||||||
return ret
|
return ret
|
||||||
if value is None:
|
if value is None:
|
||||||
ret = ""
|
ret = ''
|
||||||
else:
|
else:
|
||||||
if option:
|
if option:
|
||||||
value = self.convert_value(
|
value = self.convert_value(
|
||||||
|
|
@ -446,10 +431,7 @@ class OutputFamily:
|
||||||
ret = f"[{color}]{value}[/{color}]"
|
ret = f"[{color}]{value}[/{color}]"
|
||||||
else:
|
else:
|
||||||
ret = value
|
ret = value
|
||||||
if (
|
if default_value is not None and "force_store_value" not in option.property.get():
|
||||||
default_value is not None
|
|
||||||
and "force_store_value" not in option.property.get()
|
|
||||||
):
|
|
||||||
self.root.value_default_enable = True
|
self.root.value_default_enable = True
|
||||||
default_value_color = self.root.value_default_color
|
default_value_color = self.root.value_default_color
|
||||||
default_value = self.convert_value(option, default_value)
|
default_value = self.convert_value(option, default_value)
|
||||||
|
|
@ -461,9 +443,9 @@ class OutputFamily:
|
||||||
else:
|
else:
|
||||||
ret = f"[{default_value_color}]{default_value}[/{default_value_color}]"
|
ret = f"[{default_value_color}]{default_value}[/{default_value_color}]"
|
||||||
if loaded_from:
|
if loaded_from:
|
||||||
ret += f" ({loaded_from})"
|
ret += f' ({loaded_from})'
|
||||||
elif loaded_from:
|
elif loaded_from:
|
||||||
ret += f" ({loaded_from})"
|
ret += f' ({loaded_from})'
|
||||||
return ret
|
return ret
|
||||||
|
|
||||||
def convert_value(
|
def convert_value(
|
||||||
|
|
@ -473,7 +455,7 @@ class OutputFamily:
|
||||||
) -> str:
|
) -> str:
|
||||||
if isinstance(value, list):
|
if isinstance(value, list):
|
||||||
print(value)
|
print(value)
|
||||||
raise Exception("pfff")
|
raise Exception('pfff')
|
||||||
"""Dump variable, means transform bool, ... to yaml string"""
|
"""Dump variable, means transform bool, ... to yaml string"""
|
||||||
if not self.root.show_secrets and option.type() == "password":
|
if not self.root.show_secrets and option.type() == "password":
|
||||||
return "*" * 10
|
return "*" * 10
|
||||||
|
|
|
||||||
|
|
@ -1 +1 @@
|
||||||
__version__ = "0.2.0a11"
|
__version__ = "0.2.0a10"
|
||||||
|
|
|
||||||
|
|
@ -19,8 +19,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
from gettext import translation
|
from gettext import translation
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
t = translation(
|
t = translation("rougail_output_console", str(Path(__file__).parent / "locale"), fallback=True)
|
||||||
"rougail_output_console", str(Path(__file__).parent / "locale"), fallback=True
|
|
||||||
)
|
|
||||||
|
|
||||||
_ = t.gettext
|
_ = t.gettext
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue