Compare commits
No commits in common. "67876d77a4e46fb4e03d2f2a9339457a42c598f2" and "ff58fc056af25694d1675f5601c3a1c3e72ca5b7" have entirely different histories.
67876d77a4
...
ff58fc056a
5 changed files with 17 additions and 41 deletions
|
|
@ -1,9 +1,3 @@
|
|||
## 0.2.0a29 (2025-11-06)
|
||||
|
||||
### Feat
|
||||
|
||||
- choice if invalid value or unknown variable in user data is a fatal error or not
|
||||
|
||||
## 0.2.0a28 (2025-11-03)
|
||||
|
||||
### Feat
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ requires = ["flit_core >=3.8.0,<4"]
|
|||
|
||||
[project]
|
||||
name = "rougail.cli"
|
||||
version = "0.2.0a29"
|
||||
version = "0.2.0a28"
|
||||
authors = [{name = "Emmanuel Garette", email = "gnunux@gnunux.info"}]
|
||||
readme = "README.md"
|
||||
description = "CLI for Rougail"
|
||||
|
|
|
|||
|
|
@ -164,8 +164,7 @@ def load_user_datas(rougailconfig):
|
|||
user_data_names = rougailconfig["step.user_data"]
|
||||
except PropertiesOptionError:
|
||||
user_data_names = []
|
||||
has_layers = rougailconfig["cli.layers"]
|
||||
if has_layers:
|
||||
if rougailconfig["cli.layers"]:
|
||||
layers = [[ud] for ud in user_data_names]
|
||||
last_layers = len(layers) - 1
|
||||
else:
|
||||
|
|
@ -173,8 +172,8 @@ def load_user_datas(rougailconfig):
|
|||
last_layers = 0
|
||||
rougail = Rougail(rougailconfig)
|
||||
layer_name = "_".join(layers[-1])
|
||||
subconfig = rougail.run(name=layer_name)
|
||||
metaconfig = subconfig
|
||||
config = rougail.run(name=layer_name)
|
||||
metaconfig = config
|
||||
if last_layers:
|
||||
for layer in layers[:-1]:
|
||||
layer_name = "_".join(layer)
|
||||
|
|
@ -182,13 +181,11 @@ def load_user_datas(rougailconfig):
|
|||
metaconfig.owner.set(metaconfig.path())
|
||||
subconfig = metaconfig
|
||||
err_warn = {"errors": [], "warnings": []}
|
||||
invalid_user_datas_error = rougailconfig["cli.invalid_user_datas_error"]
|
||||
unknown_user_datas_error = rougailconfig["cli.unknown_user_datas_error"]
|
||||
interactive_user_datas = {}
|
||||
for idx, layer in enumerate(layers):
|
||||
if idx:
|
||||
subconfig = subconfig.config("_".join(layer))
|
||||
subconfig.owner.set(subconfig.path())
|
||||
config.owner.set(subconfig.path())
|
||||
subconfig.property.read_write()
|
||||
# data user
|
||||
user_datas = []
|
||||
for user_data_name in layer:
|
||||
|
|
@ -202,33 +199,22 @@ def load_user_datas(rougailconfig):
|
|||
_('cannot find "user_data" module "{0}"').format(user_data_name)
|
||||
)
|
||||
module = load_modules("rougail.user_data_" + user_data_name, str(path))
|
||||
rougail_user_datas = module.RougailUserData
|
||||
if hasattr(rougail_user_datas, 'interactive_user_datas') and rougail_user_datas.interactive_user_datas:
|
||||
interactive_user_datas[user_data_name] = rougail_user_datas
|
||||
continue
|
||||
elif interactive_user_datas:
|
||||
raise Exception(_(f'interactive user datas "{0}" is loader before uninteractive user datas "{1}"').format(list(interactive_user_datas), user_data_name))
|
||||
user_datas.extend(
|
||||
rougail_user_datas(
|
||||
module.RougailUserData(
|
||||
subconfig,
|
||||
rougailconfig=rougailconfig,
|
||||
).run()
|
||||
)
|
||||
if user_datas:
|
||||
new_err_warn = UserDatas(subconfig).user_datas(user_datas, invalid_user_datas_error=invalid_user_datas_error, unknown_user_datas_error=unknown_user_datas_error)
|
||||
new_err_warn = UserDatas(subconfig).user_datas(user_datas)
|
||||
for level, datas in new_err_warn.items():
|
||||
if datas:
|
||||
err_warn[level].updates(datas)
|
||||
for layer, rougail_user_datas in interactive_user_datas.items():
|
||||
if has_layers and len(layers) > 1:
|
||||
subconfig = metaconfig
|
||||
for idx, layer in enumerate(layers):
|
||||
if idx:
|
||||
subconfig = subconfig.config("_".join(layer))
|
||||
subconfig.owner.set(subconfig.path())
|
||||
rougail_user_datas(
|
||||
subconfig,
|
||||
rougailconfig=rougailconfig,
|
||||
).run()
|
||||
|
||||
return metaconfig, subconfig, err_warn
|
||||
return metaconfig, config, err_warn
|
||||
|
||||
|
||||
def get_output(rougailconfig, metaconfig, config, err_warn):
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
__version__ = "0.2.0a29"
|
||||
__version__ = "0.2.0a28"
|
||||
|
|
|
|||
|
|
@ -41,10 +41,6 @@ cli:
|
|||
|
||||
versions: false # {_('Displays Rougail version and all its components')}
|
||||
|
||||
invalid_user_datas_error: false # {_("Invalid value in user datas is not allowed")}
|
||||
|
||||
unknown_user_datas_error: false # {_("Unknown variable in user datas is not allowed")}
|
||||
|
||||
layers:
|
||||
description: {_('Open each user datas in separate layers')}
|
||||
default: false
|
||||
|
|
|
|||
Loading…
Reference in a new issue