feat: add 'add_help' option un TiramisuCmdLineParser + -ff => -yf

This commit is contained in:
egarette@silique.fr 2025-11-21 08:05:17 +01:00
parent 8bb9bb7e16
commit ddecd9d4e3
19 changed files with 128 additions and 12 deletions

View file

@ -19,7 +19,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
from ruamel.yaml import YAML from ruamel.yaml import YAML
from pathlib import Path from pathlib import Path
from rougail.error import ExtentionError from rougail.error import ExtensionError
from tiramisu.error import ValueOptionError, PropertiesOptionError, LeadershipError from tiramisu.error import ValueOptionError, PropertiesOptionError, LeadershipError
from .i18n import _ from .i18n import _
@ -43,7 +43,7 @@ class RougailUserDataYaml:
rougailconfig["step.user_data"] = user_data rougailconfig["step.user_data"] = user_data
user_data = rougailconfig["step.user_data"] user_data = rougailconfig["step.user_data"]
if "yaml" not in user_data: if "yaml" not in user_data:
raise ExtentionError(_("yaml is not set in step.user_data")) raise ExtensionError(_("yaml is not set in step.user_data"))
self.rougailconfig = rougailconfig self.rougailconfig = rougailconfig
self.filenames = self.rougailconfig["yaml.filename"] self.filenames = self.rougailconfig["yaml.filename"]
self.file_with_secrets = self.rougailconfig["yaml.file_with_secrets"] self.file_with_secrets = self.rougailconfig["yaml.file_with_secrets"]

View file

@ -36,7 +36,7 @@ yaml:
filename: filename:
description: {_("File or directory name where user datas are stored")} description: {_("File or directory name where user datas are stored")}
alternative_name: ff alternative_name: yf
type: unix_filename type: unix_filename
multi: true multi: true
params: params:

View file

@ -1,7 +1,7 @@
{ {
"rougail": { "rougail": {
"variable1": "80", "variable1": 80,
"variable2": "80", "variable2": 80,
"variable3": "80" "variable3": 80
} }
} }

View file

@ -1,7 +1,7 @@
{ {
"rougail": { "rougail": {
"variable1": "80", "variable1": 80,
"variable2": "80", "variable2": 80,
"variable3": "80" "variable3": 80
} }
} }

View file

@ -1,5 +1,5 @@
{ {
"rougail": { "rougail": {
"variable1": "80" "variable1": 80
} }
} }

View file

@ -0,0 +1,4 @@
{
"errors": [],
"warnings": []
}

View file

@ -0,0 +1,4 @@
{
"errors": [],
"warnings": []
}

View file

@ -0,0 +1,14 @@
{
"rougail": {
"var1": [
"string1",
"string2",
"string3"
],
"var2": [
"string1",
"string2",
"string3"
]
}
}

View file

@ -0,0 +1,14 @@
{
"rougail": {
"var1": [
"string1",
"string2",
"string3"
],
"var2": [
"string1",
"string2",
"string3"
]
}
}

View file

@ -0,0 +1 @@
{}

View file

@ -0,0 +1,12 @@
{
"rougail.var1": [
"string1",
"string2",
"string3"
],
"rougail.var2": [
"string1",
"string2",
"string3"
]
}

View file

@ -0,0 +1,11 @@
{
"rougail.var1": [
"val1",
"val2",
"val3"
],
"rougail.var2": [
"val4",
"val5"
]
}

View file

@ -0,0 +1,4 @@
{
"errors": [],
"warnings": []
}

View file

@ -0,0 +1,16 @@
{
"rougail": {
"dynval1": {
"var": "string1"
},
"dynval2": {
"var": "string1"
},
"var1": "string1",
"var2": [
"string1",
"string2",
"string3"
]
}
}

View file

@ -0,0 +1,16 @@
{
"rougail": {
"dynval1": {
"var": "string1"
},
"dynval2": {
"var": "string1"
},
"var1": "string1",
"var2": [
"string1",
"string2",
"string3"
]
}
}

View file

@ -0,0 +1,11 @@
{
"rougail": {
"dynval1": {
"var": "string1"
},
"dynval2": {
"var": "string1"
},
"var1": "string1"
}
}

View file

@ -0,0 +1,10 @@
{
"rougail.dynval1.var": "string1",
"rougail.dynval2.var": "string1",
"rougail.var1": "string1",
"rougail.var2": [
"string1",
"string2",
"string3"
]
}

View file

@ -24,7 +24,6 @@ def _test_invalid_no_error(filename):
ufilename = ifilename ufilename = ifilename
generated_user_data = RougailUserDataYaml(config, rougailconfig=rougailconfig).run() generated_user_data = RougailUserDataYaml(config, rougailconfig=rougailconfig).run()
errors = rougail.user_datas(generated_user_data, invalid_user_datas_error=invalid_user_datas_error, unknown_user_datas_error=unknown_user_datas_error) errors = rougail.user_datas(generated_user_data, invalid_user_datas_error=invalid_user_datas_error, unknown_user_datas_error=unknown_user_datas_error)
print(errors)
#expected output #expected output
expected_filename = Path('tests') / 'invalid' / 'results' / ufilename / "errors.json" expected_filename = Path('tests') / 'invalid' / 'results' / ufilename / "errors.json"
if not expected_filename.is_file(): if not expected_filename.is_file():

View file

@ -20,7 +20,7 @@ excludes = [
] ]
test_ok = get_structures_list(excludes) test_ok = get_structures_list(excludes)
# test_ok = [Path('../rougail-tests/structures/60_0family_dynamic_source_hidden')] # test_ok = [Path('../rougail-tests/structures/00_6port')]
def idfn(fixture_value): def idfn(fixture_value):