Compare commits

..

12 commits

4 changed files with 55 additions and 13 deletions

View file

@ -1,3 +1,39 @@
## 0.2.0a4 (2025-01-04)
### Fix
- add and remove not_for_commandline property
## 0.2.0a3 (2025-01-04)
### Fix
- remove upgrade feature (now in formatter project) + better support of not_for_commandline feature
## 0.2.0a2 (2024-12-11)
### Fix
- user_data and output are not plugins
## 0.2.0a1 (2024-11-28)
### Fix
- separation between run and print function
## 0.2.0a0 (2024-11-27)
### Feat
- load config from environment if rougail-user-data-environment is installed
### Fix
- translation is not mandatory
## 0.1.1 (2024-11-06)
## 0.1.1rc0 (2024-11-06)
### Fix

View file

@ -4,7 +4,7 @@ requires = ["flit_core >=3.8.0,<4"]
[project]
name = "rougail.cli"
version = "0.1.1"
version = "0.2.0a4"
authors = [{name = "Emmanuel Garette", email = "gnunux@gnunux.info"}]
readme = "README.md"
description = "CLI for Rougail"
@ -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,18 @@ 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 _
@ -33,19 +38,23 @@ def _main():
backward_compatibility=False, add_extra_options=False
)
cmd_config = rougailconfig.config
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()
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,
short_name_max_len=2,
)
parser.parse_args()
cmd_config.property.setdefault(origin_prop, 'read_write', 'append')
cmd_config.property.remove("not_for_commandline")
cmd_config.property.read_only()
if rougailconfig["upgrade"]:
RougailUpgrade(rougailconfig=rougailconfig).run()
return
try:
user_data_names = rougailconfig["step.user_data"]
except PropertiesOptionError:
@ -53,9 +62,6 @@ def _main():
output_name = rougailconfig["step.output"]
# structural
rougail = Rougail(rougailconfig)
for user_data_name in user_data_names:
rougail.converted.plugins.append("user_data_" + user_data_name)
rougail.converted.plugins.append("output_" + output_name)
config = rougail.get_config()
# data user
if not user_data_names:
@ -97,7 +103,7 @@ def _main():
rougailconfig=rougailconfig,
user_data_errors=err_warn["errors"],
user_data_warnings=err_warn["warnings"],
).run()
).print()
def main():

View file

@ -19,6 +19,6 @@ along with Mtools. If not, see <http://www.gnu.org/licenses/>.
from gettext import translation
from pathlib import Path
t = translation("rougail_cli", str(Path(__file__).parent / "locale"))
t = translation("rougail_cli", str(Path(__file__).parent / "locale"), fallback=True)
_ = t.gettext