From 3d023ceba3edced5776a207a9aba8261857869c6 Mon Sep 17 00:00:00 2001 From: Siarhei Siniak Date: Tue, 6 May 2025 19:01:53 +0300 Subject: [PATCH] [+] improve modules support --- .../fxreader/pr34/commands_typed/cli.py | 45 ++++++++++++++++++- 1 file changed, 44 insertions(+), 1 deletion(-) diff --git a/python/online/fxreader/pr34/commands_typed/cli.py b/python/online/fxreader/pr34/commands_typed/cli.py index ad6b168..51a2c02 100644 --- a/python/online/fxreader/pr34/commands_typed/cli.py +++ b/python/online/fxreader/pr34/commands_typed/cli.py @@ -481,7 +481,7 @@ class CLI(abc.ABC): def venv_compile( self, project_name: str, - force: bool, + # force: bool, argv: Optional[list[str]] = None, ) -> None: from . import cli_bootstrap @@ -549,3 +549,46 @@ class CLI(abc.ABC): project.source_dir / 'requirements.in', '-o', project.source_dir / 'requirements.txt', ]) + + def module_switch( + self, + project_name: str, + # force: bool, + argv: Optional[list[str]] = None, + ) -> None: + from . import cli_bootstrap + from . import argparse as pr34_argparse + + project = self.projects[project_name] + + parser = argparse.ArgumentParser() + parser.add_argument( + '-m', + dest='module', + choices=[ + o.name + for o in project.modules + ], + required=True, + # type=pathlib.Path, + type=str, + ) + + parser.add_argument( + '-f', + dest='file', + default='pyproject.common.toml', + default=[], + # type=pathlib.Path, + type=pathlib.Path, + ) + + options, args = pr34_argparse.parse_args( + parser, + argv, + ) + + if not options.file.is_abs(): + options.file = project.source_dir / options.file + + raise NotImplementedError