Compare commits

..

No commits in common. "c3b6c9e98c29abe581af24206e58dcd470f4879c" and "0c40462af04049b0db468c43920ed0fba4e208ca" have entirely different histories.

8 changed files with 6 additions and 59 deletions

View file

@ -1,13 +1,3 @@
## 0.2.0a41 (2026-01-12)
### Feat
- tiramisu_cache has to be defined in cli namespace
### Fix
- add test with rougailcli that assign a symlinkoption
## 0.2.0a40 (2026-01-04) ## 0.2.0a40 (2026-01-04)
### Feat ### Feat

View file

@ -4,7 +4,7 @@ requires = ["flit_core >=3.8.0,<4"]
[project] [project]
name = "rougail.cli" name = "rougail.cli"
version = "0.2.0a41" version = "0.2.0a40"
authors = [{name = "Emmanuel Garette", email = "gnunux@gnunux.info"}] authors = [{name = "Emmanuel Garette", email = "gnunux@gnunux.info"}]
readme = "README.md" readme = "README.md"
description = "CLI for Rougail" description = "CLI for Rougail"

View file

@ -297,7 +297,7 @@ def get_output(rougailconfig, metaconfig, config, err_warn, layer_datas):
_('cannot find cli file for "output_name" module "{0}"').format(output_name) _('cannot find cli file for "output_name" module "{0}"').format(output_name)
) )
module = load_modules("rougail.output_" + output_name, str(path)) module = load_modules("rougail.output_" + output_name, str(path))
root = rougailconfig["cli.root"] root = self.rougailconfig["cli.root"]
if root: if root:
subconfig = config.option(root) subconfig = config.option(root)
else: else:

View file

@ -1 +1 @@
__version__ = "0.2.0a41" __version__ = "0.2.0a40"

View file

@ -24,12 +24,6 @@ def get_rougail_config(
backward_compatibility: bool = True, # pylint: disable=unused-argument backward_compatibility: bool = True, # pylint: disable=unused-argument
) -> dict: ) -> dict:
options = f""" options = f"""
tiramisu_cache:
redefine: true
hidden: true
default:
variable: _.cli.tiramisu_cache
cli: cli:
description: {_('Command line options')} description: {_('Command line options')}
help: {_('It is possible to use Rougail directly from the command line. This makes it easy to define and configure the loaded user data and to define the desired output.')} help: {_('It is possible to use Rougail directly from the command line. This makes it easy to define and configure the loaded user data and to define the desired output.')}
@ -67,20 +61,6 @@ cli:
default: true default: true
hidden: true hidden: true
tiramisu_cache:
description: {_("Store Tiramisu cache filename")}
help: |-
{_("This file contains the Tiramisu instructions used internally to load the variables.")}"
{_("This file can be used for load Tiramisu from cache instead of regenerates it")}"
alternative_name: ct
type: unix_filename
mandatory: false
params:
allow_relative: true
types:
- file
load_from_tiramisu_cache: load_from_tiramisu_cache:
description: {_('Use cache for load Tiramisu objects')} description: {_('Use cache for load Tiramisu objects')}
help: |- help: |-
@ -89,7 +69,7 @@ cli:
{_('Note that certain user data or output can change how structure files are loaded (this is particularly true for the doc output). It is best to use the cache only for the same type of user data and output.')} {_('Note that certain user data or output can change how structure files are loaded (this is particularly true for the doc output). It is best to use the cache only for the same type of user data and output.')}
default: false default: false
disabled: disabled:
variable: _.tiramisu_cache variable: __.tiramisu_cache
when: null when: null
root: root:

View file

@ -1 +0,0 @@
["unable to load \"Main namespace name\", is a symlink option so we cannot set the value \"doc\", it will be ignored when loading from the YAML file \"symlink_rougailcli.yml\""]

View file

@ -1,4 +0,0 @@
---
main_structural_directories:
- structures
s: doc

View file

@ -134,10 +134,10 @@ def test_cli_tiramis_cache():
tmp_file.parent.mkdir(exist_ok=True) tmp_file.parent.mkdir(exist_ok=True)
tmp_file.unlink(missing_ok=True) tmp_file.unlink(missing_ok=True)
os.environ["ROUGAILCLI_CLI.CONFIG_FILE"] = 'choice_rougailcli.yml' os.environ["ROUGAILCLI_CLI.CONFIG_FILE"] = 'choice_rougailcli.yml'
main(['--cli.tiramisu_cache', str(tmp_file), '--cli.load_from_tiramisu_cache'], do_not_print=True) main(['--tiramisu_cache', str(tmp_file), '--cli.load_from_tiramisu_cache'], do_not_print=True)
# we don't want to load .rougailcli.yml file # we don't want to load .rougailcli.yml file
os.environ["ROUGAILCLI_CLI.CONFIG_FILE"] = '.unknown.yml' os.environ["ROUGAILCLI_CLI.CONFIG_FILE"] = '.unknown.yml'
ret = main(['--main_structural_directories', 'structures_warnings', '--cli.tiramisu_cache', str(tmp_file), '--cli.load_from_tiramisu_cache'], do_not_print=True) ret = main(['--main_structural_directories', 'structures_warnings', '--tiramisu_cache', str(tmp_file), '--cli.load_from_tiramisu_cache'], do_not_print=True)
filename = Path('choice_console.txt') filename = Path('choice_console.txt')
if not filename.is_file(): if not filename.is_file():
with filename.open('w') as fh: with filename.open('w') as fh:
@ -289,21 +289,3 @@ def test_cli_rougailcli_choice():
data = loads(fh.read()) data = loads(fh.read())
assert ret == (True, data), str(filename.absolute()) assert ret == (True, data), str(filename.absolute())
os.environ = save os.environ = save
def test_cli_rougailcli_symlink():
save = os.environ.copy()
with chdir(test_dir / 'rougailcli_file'):
os.environ["ROUGAILCLI_CLI.CONFIG_FILE"] = 'symlink_rougailcli.yml'
with warnings.catch_warnings(record=True) as rougail_wn:
warnings.simplefilter("always", UserWarning)
main(["-o", "doc", "--doc.output_format", "asciidoc"], do_not_print=True)
ret = [str(w.message) for w in rougail_wn]
filename = Path('symlink_rougailcli.txt')
if not filename.is_file():
with filename.open('w') as fh:
fh.write(dumps([str(w.message) for w in rougail_wn]))
with filename.open() as fh:
data = loads(fh.read())
assert ret == data, str(filename.absolute())
os.environ = save