From e62797c79fffdf0d75f15970802dafab02595388 Mon Sep 17 00:00:00 2001 From: Emmanuel Garette Date: Wed, 27 Nov 2024 09:20:30 +0100 Subject: [PATCH] feat: load config from environment if rougail-user-data-environment is installed --- pyproject.toml | 2 +- src/rougail/cli/__main__.py | 13 ++++++++++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index fe6d574..3ebd3cd 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -40,5 +40,5 @@ name = "cz_conventional_commits" tag_format = "$version" version_scheme = "pep440" version_provider = "pep621" -#update_changelog_on_bump = true +update_changelog_on_bump = true changelog_merge_prerelease = true diff --git a/src/rougail/cli/__main__.py b/src/rougail/cli/__main__.py index 7a7f892..2882954 100644 --- a/src/rougail/cli/__main__.py +++ b/src/rougail/cli/__main__.py @@ -17,13 +17,19 @@ along with Mtools. If not, see . """ from tiramisu_cmdline_parser import TiramisuCmdlineParser +from tiramisu.error import PropertiesOptionError from tiramisu import Config from pathlib import Path -from rougail import Rougail, PropertiesOptionError +from rougail import Rougail from rougail.config import get_rougail_config from rougail.update import RougailUpgrade from rougail.utils import load_modules +try: + from rougail.user_data_environment import RougailUserDataEnvironment + from rougail.user_datas import UserDatas +except ImportError: + RougailUserDataEnvironment = None from .i18n import _ @@ -35,6 +41,11 @@ def _main(): cmd_config = rougailconfig.config cmd_config.property.read_write() cmd_config.property.add("not_for_commandline") + if RougailUserDataEnvironment: + fake_rougail_config = {'step.user_data': 'environment', + 'environment.default_environment_name': 'ROUGAILCLI', + } + UserDatas(cmd_config).user_datas(RougailUserDataEnvironment(cmd_config, rougailconfig=fake_rougail_config).run()) parser = TiramisuCmdlineParser( cmd_config, add_extra_options=False,