Compare commits
7 commits
| Author | SHA256 | Date | |
|---|---|---|---|
| 04b85c0250 | |||
| e23a7e6c4b | |||
| e0a3cdd7a4 | |||
| 80eecbc4f4 | |||
| 9cca9a7443 | |||
| 1496210928 | |||
| c5757e0824 |
14 changed files with 122 additions and 65 deletions
60
CHANGELOG.md
60
CHANGELOG.md
|
|
@ -1,57 +1,21 @@
|
|||
## 1.0.0rc1 (2026-06-18)
|
||||
|
||||
### Fix
|
||||
|
||||
- dependencies
|
||||
|
||||
## 0.1.0a7 (2026-06-12)
|
||||
|
||||
### Fix
|
||||
|
||||
- add allow_unknown option
|
||||
|
||||
## 0.1.0a6 (2026-05-04)
|
||||
## 1.0.0 (2026-06-21)
|
||||
|
||||
### Feat
|
||||
|
||||
- multi layers
|
||||
|
||||
## 0.1.0a5 (2026-01-21)
|
||||
|
||||
### Fix
|
||||
|
||||
- update tests
|
||||
|
||||
## 0.1.0a4 (2025-12-30)
|
||||
|
||||
### Fix
|
||||
|
||||
- update tests
|
||||
|
||||
## 0.1.0a3 (2025-11-21)
|
||||
|
||||
### Fix
|
||||
|
||||
- ExtentionError => ExtensionError
|
||||
|
||||
## 0.1.0a2 (2025-11-06)
|
||||
|
||||
### Fix
|
||||
|
||||
- update tests
|
||||
|
||||
## 0.1.0a1 (2025-10-10)
|
||||
|
||||
### Feat
|
||||
|
||||
- add tests
|
||||
- first version
|
||||
|
||||
### Fix
|
||||
|
||||
- rougail dependencies
|
||||
- black
|
||||
- update tests
|
||||
- dependencies
|
||||
- dependencies
|
||||
- add allow_unknown option
|
||||
- update tests
|
||||
- update tests
|
||||
- ExtentionError => ExtensionError
|
||||
- update tests
|
||||
- remove print
|
||||
|
||||
## 0.1.0a0 (2025-10-06)
|
||||
|
||||
### Feat
|
||||
|
||||
- first version
|
||||
|
|
|
|||
0
README.fr.md
Normal file
0
README.fr.md
Normal file
|
|
@ -4,7 +4,7 @@ requires = ["flit_core >=3.8.0,<4"]
|
|||
|
||||
[project]
|
||||
name = "rougail.user_data_commandline"
|
||||
version = "1.0.0rc1"
|
||||
version = "1.0.0"
|
||||
authors = [{name = "Emmanuel Garette", email = "gnunux@gnunux.info"}]
|
||||
readme = "README.md"
|
||||
description = "Rougail user_data Bitwarden"
|
||||
|
|
@ -24,8 +24,8 @@ classifiers = [
|
|||
|
||||
]
|
||||
dependencies = [
|
||||
"rougail >= 1.1,<2",
|
||||
"tiramisu_cmdline_parser >= 1,<2",
|
||||
"rougail >= 1.2.0,<2",
|
||||
"tiramisu_cmdline_parser >= 1.0.0,<2",
|
||||
]
|
||||
|
||||
[project.urls]
|
||||
|
|
|
|||
|
|
@ -25,15 +25,15 @@ from .__version__ import __version__
|
|||
|
||||
|
||||
class RougailUserDataCommandline:
|
||||
"""Load parameter for commande line
|
||||
"""
|
||||
"""Load parameter for commande line"""
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
config: "Config",
|
||||
*,
|
||||
rougailconfig: "RougailConfig" = None,
|
||||
arguments = None,
|
||||
prog = None,
|
||||
arguments=None,
|
||||
prog=None,
|
||||
allow_unknown: bool = False,
|
||||
**kwargs,
|
||||
):
|
||||
|
|
@ -56,10 +56,7 @@ class RougailUserDataCommandline:
|
|||
self.warnings = []
|
||||
self.allow_unknown = allow_unknown
|
||||
self.parser = TiramisuCmdlineParser(
|
||||
self.config,
|
||||
prog=prog,
|
||||
exit_on_error=False,
|
||||
**kwargs
|
||||
self.config, prog=prog, exit_on_error=False, **kwargs
|
||||
)
|
||||
|
||||
def run(self):
|
||||
|
|
@ -76,10 +73,13 @@ class RougailUserDataCommandline:
|
|||
if not option.isfollower():
|
||||
values[key] = self.config.option(key).value.get()
|
||||
else:
|
||||
values[key] = [self.config.option(key, index).value.get() for index in range(option.value.len())]
|
||||
values[key] = [
|
||||
self.config.option(key, index).value.get()
|
||||
for index in range(option.value.len())
|
||||
]
|
||||
return [
|
||||
{
|
||||
"source": _('the command line'),
|
||||
"source": _("the command line"),
|
||||
"errors": self.errors,
|
||||
"warnings": self.warnings,
|
||||
"values": values,
|
||||
|
|
|
|||
|
|
@ -1,2 +1 @@
|
|||
__version__ = "1.0.0rc1"
|
||||
|
||||
__version__ = "1.0.0"
|
||||
|
|
|
|||
|
|
@ -20,8 +20,9 @@ from gettext import translation
|
|||
from pathlib import Path
|
||||
|
||||
t = translation(
|
||||
"rougail_user_data_commandline", str(Path(__file__).parent / "locale"), fallback=True
|
||||
"rougail_user_data_commandline",
|
||||
str(Path(__file__).parent / "locale"),
|
||||
fallback=True,
|
||||
)
|
||||
|
||||
_ = t.gettext
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,4 @@
|
|||
{
|
||||
"errors": [],
|
||||
"warnings": []
|
||||
}
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
{
|
||||
"errors": [],
|
||||
"warnings": []
|
||||
}
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
[
|
||||
"--rougail.var",
|
||||
"val1",
|
||||
"val2",
|
||||
"--rougail.dynval1.variable",
|
||||
"string1",
|
||||
"--rougail.dynval2.variable",
|
||||
"string1"
|
||||
]
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
[
|
||||
"--rougail.dynval1.variable",
|
||||
"string1",
|
||||
"--rougail.dynval2.variable",
|
||||
"string1"
|
||||
]
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
{
|
||||
"rougail.var": [
|
||||
"val1",
|
||||
"val2"
|
||||
],
|
||||
"rougail.dynval1.variable": "string1",
|
||||
"rougail.dynval2.variable": "string1"
|
||||
}
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
{
|
||||
"rougail.var": [
|
||||
"val1",
|
||||
"val2"
|
||||
],
|
||||
"rougail.dynval1.variable": "string1",
|
||||
"rougail.dynval2.variable": "string1"
|
||||
}
|
||||
6
tests/structures/rougail/00-main.yml
Normal file
6
tests/structures/rougail/00-main.yml
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
%YAML 1.2
|
||||
---
|
||||
version: 1.1
|
||||
|
||||
my_variable: # My variable
|
||||
...
|
||||
48
tests/test_others.py
Normal file
48
tests/test_others.py
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
from pathlib import Path
|
||||
|
||||
from rougail import Rougail
|
||||
from rougail.user_data_commandline import RougailUserDataCommandline as RougailUserData
|
||||
|
||||
from rougail_tests.utils import get_rougail_config, config_to_dict
|
||||
|
||||
|
||||
def test_error():
|
||||
rougailconfig = get_rougail_config(Path('tests/structures/'), True)
|
||||
##################################
|
||||
rougailconfig['step.user_data'] = ['commandline']
|
||||
##################################
|
||||
rougail = Rougail(rougailconfig)
|
||||
config = rougail.run()
|
||||
arguments = ['--rougail.unknown', 'an other value']
|
||||
generated_user_data = RougailUserData(config, rougailconfig=rougailconfig, arguments=arguments).run()
|
||||
err_warn = rougail.user_data(generated_user_data)
|
||||
assert err_warn == {'errors': ['unrecognized arguments: --rougail.unknown an other value'], 'warnings': []}
|
||||
assert dict(config_to_dict(config.value.get())) == {'rougail.my_variable': None}
|
||||
|
||||
|
||||
def test_allow_unknown_error():
|
||||
rougailconfig = get_rougail_config(Path('tests/structures/'), True)
|
||||
##################################
|
||||
rougailconfig['step.user_data'] = ['commandline']
|
||||
##################################
|
||||
rougail = Rougail(rougailconfig)
|
||||
config = rougail.run()
|
||||
arguments = ['--rougail.my_variable', 'a value', '--rougail.unknown', 'an other value']
|
||||
generated_user_data = RougailUserData(config, rougailconfig=rougailconfig, arguments=arguments).run()
|
||||
err_warn = rougail.user_data(generated_user_data)
|
||||
assert err_warn == {'errors': ['unrecognized arguments: --rougail.unknown an other value'], 'warnings': []}
|
||||
assert dict(config_to_dict(config.value.get())) == {'rougail.my_variable': 'a value'}
|
||||
|
||||
|
||||
def test_allow_unknown():
|
||||
rougailconfig = get_rougail_config(Path('tests/structures/'), True)
|
||||
##################################
|
||||
rougailconfig['step.user_data'] = ['commandline']
|
||||
##################################
|
||||
rougail = Rougail(rougailconfig)
|
||||
config = rougail.run()
|
||||
arguments = ['--rougail.my_variable', 'a value', '--rougail.unknown', 'an other value']
|
||||
generated_user_data = RougailUserData(config, rougailconfig=rougailconfig, arguments=arguments, allow_unknown=True).run()
|
||||
err_warn = rougail.user_data(generated_user_data)
|
||||
assert err_warn == {'errors': [], 'warnings': []}
|
||||
assert dict(config_to_dict(config.value.get())) == {'rougail.my_variable': 'a value'}
|
||||
Loading…
Reference in a new issue