Compare commits
3 commits
105b4fd654
...
f6e08b4ebf
| Author | SHA1 | Date | |
|---|---|---|---|
| f6e08b4ebf | |||
| 38f1e9bc4e | |||
| 437664e95a |
5 changed files with 31 additions and 7 deletions
10
CHANGELOG.md
10
CHANGELOG.md
|
|
@ -1,3 +1,13 @@
|
|||
## 0.2.0a43 (2026-03-26)
|
||||
|
||||
### Feat
|
||||
|
||||
- better mandatories support (centralized)
|
||||
|
||||
### Fix
|
||||
|
||||
- better warnings
|
||||
|
||||
## 0.2.0a42 (2026-01-21)
|
||||
|
||||
### Fix
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ requires = ["flit_core >=3.8.0,<4"]
|
|||
|
||||
[project]
|
||||
name = "rougail.cli"
|
||||
version = "0.2.0a42"
|
||||
version = "0.2.0a43"
|
||||
authors = [{name = "Emmanuel Garette", email = "gnunux@gnunux.info"}]
|
||||
readme = "README.md"
|
||||
description = "CLI for Rougail"
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ from tiramisu.error import PropertiesOptionError
|
|||
from tiramisu import MetaConfig
|
||||
|
||||
from rougail import Rougail
|
||||
from rougail.user_data import UserData
|
||||
from rougail.user_data import UserData, mandatories
|
||||
from rougail.config import get_rougail_config
|
||||
from rougail.utils import load_modules
|
||||
from rougail.error import RougailWarning
|
||||
|
|
@ -63,6 +63,10 @@ def _main(arguments, do_not_print):
|
|||
print(version)
|
||||
exit()
|
||||
layer_datas, metaconfig, config, err_warn = load_user_data(rougailconfig)
|
||||
if config and (not rougailconfig["cli.load_config"] or not rougailconfig["cli.read_write"]):
|
||||
config.property.read_only()
|
||||
if config and rougailconfig["cli.mandatory"]:
|
||||
mandatories(config, err_warn["errors"])
|
||||
output = get_output(rougailconfig,
|
||||
metaconfig,
|
||||
config,
|
||||
|
|
@ -106,7 +110,10 @@ def load_cmd_user_data(rougailconfig, arguments):
|
|||
for warning in user_data["warnings"]:
|
||||
if isinstance(warning, dict):
|
||||
for w, var in warning.items():
|
||||
warn(UserWarning(f'unable to load "{var.option.impl_get_display_name(var)}", {str(w)}'))
|
||||
if var:
|
||||
warn(UserWarning(f'unable to load "{var.option.impl_get_display_name(var)}", {str(w)}'))
|
||||
else:
|
||||
warn(w)
|
||||
else:
|
||||
warn(warning)
|
||||
if manage_warnings:
|
||||
|
|
@ -288,8 +295,6 @@ def load_user_data(rougailconfig):
|
|||
|
||||
def get_output(rougailconfig, metaconfig, config, err_warn, layer_datas):
|
||||
# output
|
||||
if config and (not rougailconfig["cli.load_config"] or not rougailconfig["cli.read_write"]):
|
||||
config.property.read_only()
|
||||
output_name = rougailconfig["step.output"]
|
||||
path = Path(__file__).parent.parent / ("output_" + output_name) / "__init__.py"
|
||||
if not path.is_file():
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
__version__ = "0.2.0a42"
|
||||
__version__ = "0.2.0a43"
|
||||
|
|
|
|||
|
|
@ -26,7 +26,6 @@ def get_rougail_config(
|
|||
options = f"""
|
||||
tiramisu_cache:
|
||||
redefine: true
|
||||
hidden: true
|
||||
default:
|
||||
variable: _.cli.tiramisu_cache
|
||||
|
||||
|
|
@ -100,6 +99,16 @@ cli:
|
|||
|
||||
read_write: false # {_('Configuration in output step is in read_write mode')}
|
||||
|
||||
mandatory:
|
||||
description: {_('test mandatories variables')}
|
||||
help: |-
|
||||
{_("The configuration must be valid before process output. It's better to validate the values at the beginning of the process.")}
|
||||
type: boolean
|
||||
default:
|
||||
jinja: |-
|
||||
{{{{ cli.read_write == false }}}}
|
||||
description: {_('if "cli.read_write" is false')}
|
||||
|
||||
description_type:
|
||||
description: {_('Type of variables description')}
|
||||
alternative_name: cd
|
||||
|
|
|
|||
Loading…
Reference in a new issue