diff options
author | crupest <crupest@outlook.com> | 2024-11-11 01:12:29 +0800 |
---|---|---|
committer | Yuqian Yang <crupest@crupest.life> | 2025-01-18 17:38:07 +0800 |
commit | 41f735ed9ddc9d96d27f7e1f2a6ca34af9cce9d9 (patch) | |
tree | ae0e509d11b974b6fda8fbef985f1e538913e6fd /tools/cru-py/cru/service/_template.py | |
parent | c0ba4d9d8d19d3faa7b4d2b3509546e37dd32364 (diff) | |
download | crupest-41f735ed9ddc9d96d27f7e1f2a6ca34af9cce9d9.tar.gz crupest-41f735ed9ddc9d96d27f7e1f2a6ca34af9cce9d9.tar.bz2 crupest-41f735ed9ddc9d96d27f7e1f2a6ca34af9cce9d9.zip |
HALF WORK: 2024.1.18
Diffstat (limited to 'tools/cru-py/cru/service/_template.py')
-rw-r--r-- | tools/cru-py/cru/service/_template.py | 17 |
1 files changed, 6 insertions, 11 deletions
diff --git a/tools/cru-py/cru/service/_template.py b/tools/cru-py/cru/service/_template.py index cc7fddf..6ab1e69 100644 --- a/tools/cru-py/cru/service/_template.py +++ b/tools/cru-py/cru/service/_template.py @@ -41,28 +41,23 @@ class TemplateManager(AppCommandFeatureProvider): ) return self._template_tree - def list_files(self) -> list[str]: - return ( - CruIterator(self.template_tree.templates) - .transform(lambda t: t[0]) - .to_list() - ) - def print_file_lists(self) -> None: - for file in self.list_files(): - print(file) + for file in CruIterator(self.template_tree.templates).transform(lambda t: t[0]): + print(file.as_posix()) def generate_files(self) -> None: config_manager = self.app.get_feature(ConfigManager) self.template_tree.generate_to( - self.generated_dir.full_path_str, config_manager.config_map + self.generated_dir.full_path_str, config_manager.get_config_str_dict() ) def get_command_info(self): return ("template", "Manage templates.") def setup_arg_parser(self, arg_parser): - subparsers = arg_parser.add_subparsers(dest="template_command") + subparsers = arg_parser.add_subparsers( + dest="template_command", required=True, metavar="TEMPLATE_COMMAND" + ) _list_parser = subparsers.add_parser("list", help="List templates.") _variables_parser = subparsers.add_parser( "variables", help="List variables for a specific template." |