feat: load config from environment if rougail-user-data-environment is installed

This commit is contained in:
egarette@silique.fr 2024-11-27 09:20:30 +01:00
parent 8073ef9bc1
commit e62797c79f
2 changed files with 13 additions and 2 deletions

View file

@ -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

View file

@ -17,13 +17,19 @@ along with Mtools. If not, see <http://www.gnu.org/licenses/>.
"""
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,