|
|
|
@ -49,7 +49,6 @@ class RougailOutputConsole:
|
|
|
|
user_data_errors: Optional[list] = None,
|
|
|
|
user_data_errors: Optional[list] = None,
|
|
|
|
user_data_warnings: Optional[list] = None,
|
|
|
|
user_data_warnings: Optional[list] = None,
|
|
|
|
config_owner_is_path: bool = False,
|
|
|
|
config_owner_is_path: bool = False,
|
|
|
|
layer_datas = None,
|
|
|
|
|
|
|
|
**kwargs
|
|
|
|
**kwargs
|
|
|
|
) -> None:
|
|
|
|
) -> None:
|
|
|
|
if rougailconfig is None:
|
|
|
|
if rougailconfig is None:
|
|
|
|
@ -59,7 +58,6 @@ class RougailOutputConsole:
|
|
|
|
self.rougailconfig = rougailconfig
|
|
|
|
self.rougailconfig = rougailconfig
|
|
|
|
self.config = config
|
|
|
|
self.config = config
|
|
|
|
self.metaconfig = metaconfig
|
|
|
|
self.metaconfig = metaconfig
|
|
|
|
self.layer_datas = layer_datas
|
|
|
|
|
|
|
|
self.config_owner_is_path = config_owner_is_path
|
|
|
|
self.config_owner_is_path = config_owner_is_path
|
|
|
|
self.is_mandatory = self.rougailconfig["console.mandatory"]
|
|
|
|
self.is_mandatory = self.rougailconfig["console.mandatory"]
|
|
|
|
self.show_secrets = self.rougailconfig["console.show_secrets"]
|
|
|
|
self.show_secrets = self.rougailconfig["console.show_secrets"]
|
|
|
|
@ -104,10 +102,7 @@ class RougailOutputConsole:
|
|
|
|
current_options = options
|
|
|
|
current_options = options
|
|
|
|
for child_path in option.path().split('.'):
|
|
|
|
for child_path in option.path().split('.'):
|
|
|
|
child = parent.option(child_path)
|
|
|
|
child = parent.option(child_path)
|
|
|
|
if self.key_is_description:
|
|
|
|
|
|
|
|
description = child.description(uncalculated=True)
|
|
|
|
description = child.description(uncalculated=True)
|
|
|
|
else:
|
|
|
|
|
|
|
|
description = child.path(uncalculated=True)
|
|
|
|
|
|
|
|
if child.isdynamic() and "{{ identifier }}" in description:
|
|
|
|
if child.isdynamic() and "{{ identifier }}" in description:
|
|
|
|
description = description.replace('{{ identifier }}', child.identifiers()[-1])
|
|
|
|
description = description.replace('{{ identifier }}', child.identifiers()[-1])
|
|
|
|
|
|
|
|
|
|
|
|
@ -119,13 +114,9 @@ class RougailOutputConsole:
|
|
|
|
if options:
|
|
|
|
if options:
|
|
|
|
self.errors.append({_("The following variables are mandatory but have no value:"): options})
|
|
|
|
self.errors.append({_("The following variables are mandatory but have no value:"): options})
|
|
|
|
elif options_with_error:
|
|
|
|
elif options_with_error:
|
|
|
|
if self.key_is_description:
|
|
|
|
|
|
|
|
variables = [option.description() for option in options_with_error]
|
|
|
|
|
|
|
|
else:
|
|
|
|
|
|
|
|
variables = [option.path() for option in options_with_error]
|
|
|
|
|
|
|
|
self.errors.append({_(
|
|
|
|
self.errors.append({_(
|
|
|
|
"The following variables are inaccessible but are empty and mandatory:"
|
|
|
|
"The following variables are inaccessible but are empty and mandatory:"
|
|
|
|
): variables})
|
|
|
|
): [option.description() for option in options_with_error]})
|
|
|
|
|
|
|
|
|
|
|
|
def exporter(self) -> bool:
|
|
|
|
def exporter(self) -> bool:
|
|
|
|
if self.is_mandatory:
|
|
|
|
if self.is_mandatory:
|
|
|
|
@ -206,15 +197,15 @@ class RougailOutputConsole:
|
|
|
|
leader_obj.add_variable(follower)
|
|
|
|
leader_obj.add_variable(follower)
|
|
|
|
|
|
|
|
|
|
|
|
def header(self):
|
|
|
|
def header(self):
|
|
|
|
caption_line = ""
|
|
|
|
header_variable = ""
|
|
|
|
if self.variable_default_enable:
|
|
|
|
if self.variable_default_enable:
|
|
|
|
caption_line += _("Variable") + "\n"
|
|
|
|
header_variable += _("Variable") + "\n"
|
|
|
|
if self.variable_advanced_enable:
|
|
|
|
if self.variable_advanced_enable:
|
|
|
|
caption_line += 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:
|
|
|
|
caption_line += 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:
|
|
|
|
caption_line += 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'
|
|
|
|
@ -222,29 +213,10 @@ class RougailOutputConsole:
|
|
|
|
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}]:hourglass_flowing_sand: {_("Original default value")}[/{self.value_default_color}])\n'
|
|
|
|
header_value += f'([{self.value_default_color}]:hourglass_flowing_sand: {_("Original default value")}[/{self.value_default_color}])\n'
|
|
|
|
caption = Table.grid(padding=1, collapse_padding=True)
|
|
|
|
header = Table.grid(padding=1, collapse_padding=True)
|
|
|
|
caption.pad_edge = False
|
|
|
|
header.pad_edge = False
|
|
|
|
caption.add_row(caption_line[:-1], header_value[:-1])
|
|
|
|
header.add_row(header_variable[:-1], header_value[:-1])
|
|
|
|
self.out.append(Panel.fit(caption, title=_("Caption")))
|
|
|
|
self.out.append(Panel.fit(header, title=_("Caption")))
|
|
|
|
#
|
|
|
|
|
|
|
|
layers = Table.grid(padding=1, collapse_padding=True)
|
|
|
|
|
|
|
|
caption.pad_edge = False
|
|
|
|
|
|
|
|
if self.layer_datas:
|
|
|
|
|
|
|
|
max_len = 0
|
|
|
|
|
|
|
|
for datas in self.layer_datas.values():
|
|
|
|
|
|
|
|
for data in datas.values():
|
|
|
|
|
|
|
|
max_len = max(max_len, len(data))
|
|
|
|
|
|
|
|
display_layers = ["" for i in range(max_len)]
|
|
|
|
|
|
|
|
for datas in self.layer_datas.values():
|
|
|
|
|
|
|
|
for data in datas.values():
|
|
|
|
|
|
|
|
last_index = len(data) - 1
|
|
|
|
|
|
|
|
for idx in range(max_len):
|
|
|
|
|
|
|
|
if last_index < idx:
|
|
|
|
|
|
|
|
display_layers[idx] += "\n"
|
|
|
|
|
|
|
|
else:
|
|
|
|
|
|
|
|
display_layers[idx] += data[idx] + "\n"
|
|
|
|
|
|
|
|
layers.add_row(*[layer[:-1] for layer in display_layers])
|
|
|
|
|
|
|
|
self.out.append(Panel.fit(layers, title=_("Layers")))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def display_errors(
|
|
|
|
def display_errors(
|
|
|
|
self,
|
|
|
|
self,
|
|
|
|
|