Compare commits
No commits in common. "c31652256f5f8bc27a3c3d63c7d1ba508333352d" and "3f2920f37c1bc167284f5238a1f8b18b8e635538" have entirely different histories.
c31652256f
...
3f2920f37c
4 changed files with 6 additions and 35 deletions
|
|
@ -1,9 +1,3 @@
|
|||
## 0.2.0a9 (2025-03-31)
|
||||
|
||||
### Feat
|
||||
|
||||
- cli loads .rougailcli.yml file
|
||||
|
||||
## 0.2.0a8 (2025-02-17)
|
||||
|
||||
### Fix
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ requires = ["flit_core >=3.8.0,<4"]
|
|||
|
||||
[project]
|
||||
name = "rougail.cli"
|
||||
version = "0.2.0a9"
|
||||
version = "0.2.0a8"
|
||||
authors = [{name = "Emmanuel Garette", email = "gnunux@gnunux.info"}]
|
||||
readme = "README.md"
|
||||
description = "CLI for Rougail"
|
||||
|
|
|
|||
|
|
@ -24,13 +24,9 @@ from pathlib import Path
|
|||
from rougail import Rougail
|
||||
from rougail.config import get_rougail_config
|
||||
from rougail.utils import load_modules
|
||||
from rougail.user_datas import UserDatas
|
||||
try:
|
||||
from rougail.user_data_yaml import RougailUserDataYaml
|
||||
except ImportError:
|
||||
RougailUserDataYaml = None
|
||||
try:
|
||||
from rougail.user_data_environment import RougailUserDataEnvironment
|
||||
from rougail.user_datas import UserDatas
|
||||
except ImportError:
|
||||
RougailUserDataEnvironment = None
|
||||
|
||||
|
|
@ -46,21 +42,11 @@ def _main():
|
|||
origin_prop = cmd_config.property.default('read_write', 'append')
|
||||
cmd_config.property.setdefault(frozenset(origin_prop | {"not_for_commandline"}), 'read_write', 'append')
|
||||
cmd_config.property.read_write()
|
||||
fake_rougail_config = {'step.user_data': [],}
|
||||
fake_user_datas = []
|
||||
if RougailUserDataYaml and Path(rougailconfig["cli.config_file"]).is_file():
|
||||
fake_rougail_config = {'step.user_data': 'yaml',
|
||||
'yaml.filename': [rougailconfig["cli.config_file"]],
|
||||
'yaml.file_with_secrets': 'all',
|
||||
}
|
||||
fake_user_datas.extend(RougailUserDataYaml(cmd_config, rougailconfig=fake_rougail_config).run())
|
||||
if RougailUserDataEnvironment:
|
||||
fake_rougail_config = {'step.user_data': 'environment',
|
||||
'environment.default_environment_name': 'ROUGAILCLI',
|
||||
}
|
||||
fake_user_datas.extend(RougailUserDataEnvironment(cmd_config, rougailconfig=fake_rougail_config).run())
|
||||
if fake_user_datas:
|
||||
user_data = UserDatas(cmd_config).user_datas(fake_user_datas)
|
||||
user_data = UserDatas(cmd_config).user_datas(RougailUserDataEnvironment(cmd_config, rougailconfig=fake_rougail_config).run())
|
||||
if user_data["errors"]:
|
||||
raise Exception(user_data["errors"][0])
|
||||
if user_data["warnings"]:
|
||||
|
|
@ -80,6 +66,7 @@ def _main():
|
|||
user_data_names = rougailconfig["step.user_data"]
|
||||
except PropertiesOptionError:
|
||||
user_data_names = []
|
||||
output_name = rougailconfig["step.output"]
|
||||
# structural
|
||||
rougail = Rougail(rougailconfig)
|
||||
config = rougail.run()
|
||||
|
|
@ -114,6 +101,7 @@ def _main():
|
|||
err_warn = {"errors": [], "warnings": []}
|
||||
if user_data_names:
|
||||
config.property.read_write()
|
||||
user_datas = []
|
||||
for user_data_name in user_data_names:
|
||||
path = (
|
||||
Path(__file__).parent.parent
|
||||
|
|
@ -130,7 +118,6 @@ def _main():
|
|||
err_warn["warnings"].extend(ret["warnings"])
|
||||
# output
|
||||
config.property.read_only()
|
||||
output_name = rougailconfig["step.output"]
|
||||
path = Path(__file__).parent.parent / ("output_" + output_name) / "__init__.py"
|
||||
if not path.is_file():
|
||||
raise Exception(
|
||||
|
|
@ -149,7 +136,7 @@ def _main():
|
|||
|
||||
def main():
|
||||
global print_traceback
|
||||
print_traceback = True
|
||||
print_traceback = False
|
||||
try:
|
||||
_main()
|
||||
except Exception as err:
|
||||
|
|
|
|||
|
|
@ -25,16 +25,6 @@ def get_rougail_config(
|
|||
) -> dict:
|
||||
options = f"""
|
||||
cli:
|
||||
description: {_('Command line option')}
|
||||
|
||||
config_file:
|
||||
description: {_('display debug informations')}
|
||||
type: unix_filename
|
||||
commandline: false
|
||||
params:
|
||||
allow_relative: true
|
||||
default: .rougailcli.yml
|
||||
|
||||
debug:
|
||||
description: {_('display debug informations')}
|
||||
negative_description: {_('do not display debut informations')}
|
||||
|
|
|
|||
Loading…
Reference in a new issue