Updated docs
This commit is contained in:
@@ -1,26 +1,26 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
"""
|
||||
cpl-cli sh-edraft Common Python library CLI
|
||||
cpl-cli CPL CLI
|
||||
~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
sh-edraft Common Python library Command Line Interface
|
||||
CPL Command Line Interface
|
||||
|
||||
:copyright: (c) 2020 - 2023 sh-edraft.de
|
||||
:license: MIT, see LICENSE for more details.
|
||||
|
||||
"""
|
||||
|
||||
__title__ = 'cpl_cli'
|
||||
__author__ = 'Sven Heidemann'
|
||||
__license__ = 'MIT'
|
||||
__copyright__ = 'Copyright (c) 2020 - 2023 sh-edraft.de'
|
||||
__version__ = '2022.12.1'
|
||||
__title__ = "cpl_cli"
|
||||
__author__ = "Sven Heidemann"
|
||||
__license__ = "MIT"
|
||||
__copyright__ = "Copyright (c) 2020 - 2023 sh-edraft.de"
|
||||
__version__ = "2023.2.0"
|
||||
|
||||
from collections import namedtuple
|
||||
|
||||
|
||||
# imports:
|
||||
|
||||
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
|
||||
version_info = VersionInfo(major='2022', minor='12', micro='1')
|
||||
VersionInfo = namedtuple("VersionInfo", "major minor micro")
|
||||
version_info = VersionInfo(major="2023", minor="2", micro="0")
|
||||
|
||||
@@ -4,17 +4,16 @@ from cpl_core.utils import String
|
||||
|
||||
|
||||
class Console(ProjectTypeABC):
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
base_path: str,
|
||||
project_name: str,
|
||||
workspace: WorkspaceSettings,
|
||||
use_application_api: bool,
|
||||
use_startup: bool,
|
||||
use_service_providing: bool,
|
||||
use_async: bool,
|
||||
project_file_data: dict,
|
||||
self,
|
||||
base_path: str,
|
||||
project_name: str,
|
||||
workspace: WorkspaceSettings,
|
||||
use_application_api: bool,
|
||||
use_startup: bool,
|
||||
use_service_providing: bool,
|
||||
use_async: bool,
|
||||
project_file_data: dict,
|
||||
):
|
||||
from project_file import ProjectFile
|
||||
from project_file_appsettings import ProjectFileAppsettings
|
||||
@@ -25,23 +24,46 @@ class Console(ProjectTypeABC):
|
||||
from project_file_license import ProjectFileLicense
|
||||
from schematic_init import Init
|
||||
|
||||
ProjectTypeABC.__init__(self, base_path, project_name, workspace, use_application_api, use_startup, use_service_providing, use_async, project_file_data)
|
||||
ProjectTypeABC.__init__(
|
||||
self,
|
||||
base_path,
|
||||
project_name,
|
||||
workspace,
|
||||
use_application_api,
|
||||
use_startup,
|
||||
use_service_providing,
|
||||
use_async,
|
||||
project_file_data,
|
||||
)
|
||||
|
||||
project_path = f'{base_path}{String.convert_to_snake_case(project_name.split("/")[-1])}/'
|
||||
|
||||
self.add_template(ProjectFile(project_name.split('/')[-1], project_path, project_file_data))
|
||||
self.add_template(ProjectFile(project_name.split("/")[-1], project_path, project_file_data))
|
||||
if workspace is None:
|
||||
self.add_template(ProjectFileLicense(''))
|
||||
self.add_template(ProjectFileReadme(''))
|
||||
self.add_template(Init('', 'init', f'{base_path}tests/'))
|
||||
self.add_template(ProjectFileLicense(""))
|
||||
self.add_template(ProjectFileReadme(""))
|
||||
self.add_template(Init("", "init", f"{base_path}tests/"))
|
||||
|
||||
self.add_template(Init('', 'init', project_path))
|
||||
self.add_template(Init("", "init", project_path))
|
||||
self.add_template(ProjectFileAppsettings(project_path))
|
||||
|
||||
if use_application_api:
|
||||
self.add_template(ProjectFileApplication(project_path, use_application_api, use_startup, use_service_providing, use_async))
|
||||
self.add_template(
|
||||
ProjectFileApplication(project_path, use_application_api, use_startup, use_service_providing, use_async)
|
||||
)
|
||||
|
||||
if use_startup:
|
||||
self.add_template(ProjectFileStartup(project_path, use_application_api, use_startup, use_service_providing, use_async))
|
||||
self.add_template(
|
||||
ProjectFileStartup(project_path, use_application_api, use_startup, use_service_providing, use_async)
|
||||
)
|
||||
|
||||
self.add_template(ProjectFileMain(project_name.split('/')[-1], project_path, use_application_api, use_startup, use_service_providing, use_async))
|
||||
self.add_template(
|
||||
ProjectFileMain(
|
||||
project_name.split("/")[-1],
|
||||
project_path,
|
||||
use_application_api,
|
||||
use_startup,
|
||||
use_service_providing,
|
||||
use_async,
|
||||
)
|
||||
)
|
||||
|
||||
@@ -4,10 +4,9 @@ from cpl_cli.abc.file_template_abc import FileTemplateABC
|
||||
|
||||
|
||||
class ProjectFile(FileTemplateABC):
|
||||
|
||||
def __init__(self, name: str, path: str, code: dict):
|
||||
FileTemplateABC.__init__(self, '', path, '{}')
|
||||
self._name = f'{name}.json'
|
||||
FileTemplateABC.__init__(self, "", path, "{}")
|
||||
self._name = f"{name}.json"
|
||||
self._code = code
|
||||
|
||||
def get_code(self) -> str:
|
||||
|
||||
@@ -4,13 +4,13 @@ from cpl_cli.abc.file_template_abc import FileTemplateABC
|
||||
|
||||
|
||||
class ProjectFileAppsettings(FileTemplateABC):
|
||||
|
||||
def __init__(self, path: str):
|
||||
FileTemplateABC.__init__(self, '', path, '{}')
|
||||
self._name = 'appsettings.json'
|
||||
FileTemplateABC.__init__(self, "", path, "{}")
|
||||
self._name = "appsettings.json"
|
||||
|
||||
def get_code(self) -> str:
|
||||
return textwrap.dedent("""\
|
||||
return textwrap.dedent(
|
||||
"""\
|
||||
{
|
||||
"TimeFormatSettings": {
|
||||
"DateFormat": "%Y-%m-%d",
|
||||
@@ -25,4 +25,5 @@ class ProjectFileAppsettings(FileTemplateABC):
|
||||
"FileLogLevel": "WARN"
|
||||
}
|
||||
}
|
||||
""")
|
||||
"""
|
||||
)
|
||||
|
||||
@@ -2,15 +2,19 @@ from cpl_cli.abc.code_file_template_abc import CodeFileTemplateABC
|
||||
|
||||
|
||||
class ProjectFileApplication(CodeFileTemplateABC):
|
||||
|
||||
def __init__(self, path: str, use_application_api: bool, use_startup: bool, use_service_providing: bool, use_async: bool):
|
||||
CodeFileTemplateABC.__init__(self, 'application', path, '', use_application_api, use_startup, use_service_providing, use_async)
|
||||
def __init__(
|
||||
self, path: str, use_application_api: bool, use_startup: bool, use_service_providing: bool, use_async: bool
|
||||
):
|
||||
CodeFileTemplateABC.__init__(
|
||||
self, "application", path, "", use_application_api, use_startup, use_service_providing, use_async
|
||||
)
|
||||
|
||||
def get_code(self) -> str:
|
||||
import textwrap
|
||||
|
||||
if self._use_async:
|
||||
return textwrap.dedent("""\
|
||||
return textwrap.dedent(
|
||||
"""\
|
||||
from cpl_core.application import ApplicationABC
|
||||
from cpl_core.configuration import ConfigurationABC
|
||||
from cpl_core.console import Console
|
||||
@@ -27,9 +31,11 @@ class ProjectFileApplication(CodeFileTemplateABC):
|
||||
|
||||
async def main(self):
|
||||
Console.write_line('Hello World')
|
||||
""")
|
||||
"""
|
||||
)
|
||||
|
||||
return textwrap.dedent("""\
|
||||
return textwrap.dedent(
|
||||
"""\
|
||||
from cpl_core.application import ApplicationABC
|
||||
from cpl_core.configuration import ConfigurationABC
|
||||
from cpl_core.console import Console
|
||||
@@ -46,4 +52,5 @@ class ProjectFileApplication(CodeFileTemplateABC):
|
||||
|
||||
def main(self):
|
||||
Console.write_line('Hello World')
|
||||
""")
|
||||
"""
|
||||
)
|
||||
|
||||
@@ -3,15 +3,25 @@ from cpl_core.utils import String
|
||||
|
||||
|
||||
class ProjectFileMain(CodeFileTemplateABC):
|
||||
|
||||
def __init__(self, name: str, path: str, use_application_api: bool, use_startup: bool, use_service_providing: bool, use_async: bool):
|
||||
CodeFileTemplateABC.__init__(self, 'main', path, '', use_application_api, use_startup, use_service_providing, use_async)
|
||||
def __init__(
|
||||
self,
|
||||
name: str,
|
||||
path: str,
|
||||
use_application_api: bool,
|
||||
use_startup: bool,
|
||||
use_service_providing: bool,
|
||||
use_async: bool,
|
||||
):
|
||||
CodeFileTemplateABC.__init__(
|
||||
self, "main", path, "", use_application_api, use_startup, use_service_providing, use_async
|
||||
)
|
||||
|
||||
import textwrap
|
||||
|
||||
import_pkg = f'{String.convert_to_snake_case(name)}.'
|
||||
import_pkg = f"{String.convert_to_snake_case(name)}."
|
||||
|
||||
self._main_with_application_host_and_startup = textwrap.dedent(f"""\
|
||||
self._main_with_application_host_and_startup = textwrap.dedent(
|
||||
f"""\
|
||||
{"import asyncio" if self._use_async else ''}
|
||||
|
||||
from cpl_core.application import ApplicationBuilder
|
||||
@@ -29,8 +39,10 @@ class ProjectFileMain(CodeFileTemplateABC):
|
||||
|
||||
if __name__ == '__main__':
|
||||
{"asyncio.run(main())" if self._use_async else "main()"}
|
||||
""")
|
||||
self._main_with_application_base = textwrap.dedent(f"""\
|
||||
"""
|
||||
)
|
||||
self._main_with_application_base = textwrap.dedent(
|
||||
f"""\
|
||||
{"import asyncio" if self._use_async else ''}
|
||||
|
||||
from cpl_core.application import ApplicationBuilder
|
||||
@@ -46,9 +58,11 @@ class ProjectFileMain(CodeFileTemplateABC):
|
||||
|
||||
if __name__ == '__main__':
|
||||
{"asyncio.run(main())" if self._use_async else "main()"}
|
||||
""")
|
||||
"""
|
||||
)
|
||||
|
||||
self._main_with_dependency_injection = textwrap.dedent(f"""\
|
||||
self._main_with_dependency_injection = textwrap.dedent(
|
||||
f"""\
|
||||
{"import asyncio" if self._use_async else ''}
|
||||
|
||||
from cpl_core.application import ApplicationBuilder
|
||||
@@ -72,12 +86,13 @@ class ProjectFileMain(CodeFileTemplateABC):
|
||||
|
||||
if __name__ == '__main__':
|
||||
{"asyncio.run(main())" if self._use_async else "main()"}
|
||||
""")
|
||||
"""
|
||||
)
|
||||
|
||||
def _async(self) -> str:
|
||||
if self._use_async:
|
||||
return 'async '
|
||||
return ''
|
||||
return "async "
|
||||
return ""
|
||||
|
||||
def get_code(self) -> str:
|
||||
if self._use_application_api and self._use_startup:
|
||||
|
||||
@@ -2,14 +2,18 @@ from cpl_cli.abc.code_file_template_abc import CodeFileTemplateABC
|
||||
|
||||
|
||||
class ProjectFileStartup(CodeFileTemplateABC):
|
||||
|
||||
def __init__(self, path: str, use_application_api: bool, use_startup: bool, use_service_providing: bool, use_async: bool):
|
||||
CodeFileTemplateABC.__init__(self, 'startup', path, '', use_application_api, use_startup, use_service_providing, use_async)
|
||||
def __init__(
|
||||
self, path: str, use_application_api: bool, use_startup: bool, use_service_providing: bool, use_async: bool
|
||||
):
|
||||
CodeFileTemplateABC.__init__(
|
||||
self, "startup", path, "", use_application_api, use_startup, use_service_providing, use_async
|
||||
)
|
||||
|
||||
def get_code(self) -> str:
|
||||
import textwrap
|
||||
|
||||
return textwrap.dedent("""\
|
||||
return textwrap.dedent(
|
||||
"""\
|
||||
from cpl_core.application import StartupABC
|
||||
from cpl_core.configuration import ConfigurationABC
|
||||
from cpl_core.dependency_injection import ServiceProviderABC, ServiceCollectionABC
|
||||
@@ -26,4 +30,5 @@ class ProjectFileStartup(CodeFileTemplateABC):
|
||||
|
||||
def configure_services(self, services: ServiceCollectionABC, environment: ApplicationEnvironment) -> ServiceProviderABC:
|
||||
return services.build_service_provider()
|
||||
""")
|
||||
"""
|
||||
)
|
||||
|
||||
@@ -2,15 +2,19 @@ from cpl_cli.abc.code_file_template_abc import CodeFileTemplateABC
|
||||
|
||||
|
||||
class ProjectFileTestApplication(CodeFileTemplateABC):
|
||||
|
||||
def __init__(self, path: str, use_application_api: bool, use_startup: bool, use_service_providing: bool, use_async: bool):
|
||||
CodeFileTemplateABC.__init__(self, 'application', path, '', use_application_api, use_startup, use_service_providing, use_async)
|
||||
def __init__(
|
||||
self, path: str, use_application_api: bool, use_startup: bool, use_service_providing: bool, use_async: bool
|
||||
):
|
||||
CodeFileTemplateABC.__init__(
|
||||
self, "application", path, "", use_application_api, use_startup, use_service_providing, use_async
|
||||
)
|
||||
|
||||
def get_code(self) -> str:
|
||||
import textwrap
|
||||
|
||||
if self._use_async:
|
||||
return textwrap.dedent("""\
|
||||
return textwrap.dedent(
|
||||
"""\
|
||||
import unittest
|
||||
from unittest import TestSuite
|
||||
|
||||
@@ -32,9 +36,11 @@ class ProjectFileTestApplication(CodeFileTemplateABC):
|
||||
async def main(self):
|
||||
runner = unittest.TextTestRunner()
|
||||
runner.run(self._suite)
|
||||
""")
|
||||
"""
|
||||
)
|
||||
|
||||
return textwrap.dedent("""\
|
||||
return textwrap.dedent(
|
||||
"""\
|
||||
import unittest
|
||||
from unittest import TestSuite
|
||||
|
||||
@@ -56,4 +62,5 @@ class ProjectFileTestApplication(CodeFileTemplateABC):
|
||||
def main(self):
|
||||
runner = unittest.TextTestRunner()
|
||||
runner.run(self._suite)
|
||||
""")
|
||||
"""
|
||||
)
|
||||
|
||||
@@ -2,15 +2,19 @@ from cpl_cli.abc.code_file_template_abc import CodeFileTemplateABC
|
||||
|
||||
|
||||
class ProjectFileTestCase(CodeFileTemplateABC):
|
||||
|
||||
def __init__(self, path: str, use_application_api: bool, use_startup: bool, use_service_providing: bool, use_async: bool):
|
||||
CodeFileTemplateABC.__init__(self, 'test_case', path, '', use_application_api, use_startup, use_service_providing, use_async)
|
||||
def __init__(
|
||||
self, path: str, use_application_api: bool, use_startup: bool, use_service_providing: bool, use_async: bool
|
||||
):
|
||||
CodeFileTemplateABC.__init__(
|
||||
self, "test_case", path, "", use_application_api, use_startup, use_service_providing, use_async
|
||||
)
|
||||
|
||||
def get_code(self) -> str:
|
||||
import textwrap
|
||||
|
||||
if self._use_async:
|
||||
return textwrap.dedent("""\
|
||||
return textwrap.dedent(
|
||||
"""\
|
||||
import unittest
|
||||
|
||||
|
||||
@@ -21,9 +25,11 @@ class ProjectFileTestCase(CodeFileTemplateABC):
|
||||
|
||||
async def test_equal(self):
|
||||
self.assertEqual(True, True)
|
||||
""")
|
||||
"""
|
||||
)
|
||||
|
||||
return textwrap.dedent("""\
|
||||
return textwrap.dedent(
|
||||
"""\
|
||||
import unittest
|
||||
|
||||
|
||||
@@ -34,4 +40,5 @@ class ProjectFileTestCase(CodeFileTemplateABC):
|
||||
|
||||
def test_equal(self):
|
||||
self.assertEqual(True, True)
|
||||
""")
|
||||
"""
|
||||
)
|
||||
|
||||
@@ -2,10 +2,9 @@ from cpl_cli.abc.file_template_abc import FileTemplateABC
|
||||
|
||||
|
||||
class ProjectFileLicense(FileTemplateABC):
|
||||
|
||||
def __init__(self, path: str):
|
||||
FileTemplateABC.__init__(self, '', path, '')
|
||||
self._name = 'LICENSE'
|
||||
FileTemplateABC.__init__(self, "", path, "")
|
||||
self._name = "LICENSE"
|
||||
|
||||
def get_code(self) -> str:
|
||||
return self._code
|
||||
|
||||
@@ -2,10 +2,9 @@ from cpl_cli.abc.file_template_abc import FileTemplateABC
|
||||
|
||||
|
||||
class ProjectFileReadme(FileTemplateABC):
|
||||
|
||||
def __init__(self, path: str):
|
||||
FileTemplateABC.__init__(self, '', path, '')
|
||||
self._name = 'README.md'
|
||||
FileTemplateABC.__init__(self, "", path, "")
|
||||
self._name = "README.md"
|
||||
|
||||
def get_code(self) -> str:
|
||||
return self._code
|
||||
|
||||
@@ -6,17 +6,16 @@ from cpl_core.utils import String
|
||||
|
||||
|
||||
class Library(ProjectTypeABC):
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
base_path: str,
|
||||
project_name: str,
|
||||
workspace: WorkspaceSettings,
|
||||
use_application_api: bool,
|
||||
use_startup: bool,
|
||||
use_service_providing: bool,
|
||||
use_async: bool,
|
||||
project_file_data: dict,
|
||||
self,
|
||||
base_path: str,
|
||||
project_name: str,
|
||||
workspace: WorkspaceSettings,
|
||||
use_application_api: bool,
|
||||
use_startup: bool,
|
||||
use_service_providing: bool,
|
||||
use_async: bool,
|
||||
project_file_data: dict,
|
||||
):
|
||||
from project_file import ProjectFile
|
||||
from project_file_readme import ProjectFileReadme
|
||||
@@ -24,14 +23,24 @@ class Library(ProjectTypeABC):
|
||||
from schematic_init import Init
|
||||
from schematic_class import Class
|
||||
|
||||
ProjectTypeABC.__init__(self, base_path, project_name, workspace, use_application_api, use_startup, use_service_providing, use_async, project_file_data)
|
||||
ProjectTypeABC.__init__(
|
||||
self,
|
||||
base_path,
|
||||
project_name,
|
||||
workspace,
|
||||
use_application_api,
|
||||
use_startup,
|
||||
use_service_providing,
|
||||
use_async,
|
||||
project_file_data,
|
||||
)
|
||||
|
||||
project_path = f'{base_path}{String.convert_to_snake_case(project_name.split("/")[-1])}/'
|
||||
|
||||
self.add_template(ProjectFile(project_name.split('/')[-1], project_path, project_file_data))
|
||||
self.add_template(ProjectFile(project_name.split("/")[-1], project_path, project_file_data))
|
||||
if workspace is None:
|
||||
self.add_template(ProjectFileLicense(''))
|
||||
self.add_template(ProjectFileReadme(''))
|
||||
self.add_template(ProjectFileLicense(""))
|
||||
self.add_template(ProjectFileReadme(""))
|
||||
|
||||
self.add_template(Init('', 'init', project_path))
|
||||
self.add_template(Class('Class1', 'class', project_path))
|
||||
self.add_template(Init("", "init", project_path))
|
||||
self.add_template(Class("Class1", "class", project_path))
|
||||
|
||||
@@ -6,17 +6,16 @@ from cpl_core.utils import String
|
||||
|
||||
|
||||
class Unittest(ProjectTypeABC):
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
base_path: str,
|
||||
project_name: str,
|
||||
workspace: WorkspaceSettings,
|
||||
use_application_api: bool,
|
||||
use_startup: bool,
|
||||
use_service_providing: bool,
|
||||
use_async: bool,
|
||||
project_file_data: dict,
|
||||
self,
|
||||
base_path: str,
|
||||
project_name: str,
|
||||
workspace: WorkspaceSettings,
|
||||
use_application_api: bool,
|
||||
use_startup: bool,
|
||||
use_service_providing: bool,
|
||||
use_async: bool,
|
||||
project_file_data: dict,
|
||||
):
|
||||
from project_file import ProjectFile
|
||||
from project_file_code_application import ProjectFileApplication
|
||||
@@ -26,17 +25,40 @@ class Unittest(ProjectTypeABC):
|
||||
from project_file_license import ProjectFileLicense
|
||||
from schematic_init import Init
|
||||
|
||||
ProjectTypeABC.__init__(self, base_path, project_name, workspace, use_application_api, use_startup, use_service_providing, use_async, project_file_data)
|
||||
ProjectTypeABC.__init__(
|
||||
self,
|
||||
base_path,
|
||||
project_name,
|
||||
workspace,
|
||||
use_application_api,
|
||||
use_startup,
|
||||
use_service_providing,
|
||||
use_async,
|
||||
project_file_data,
|
||||
)
|
||||
|
||||
project_path = f'{base_path}{String.convert_to_snake_case(project_name.split("/")[-1])}/'
|
||||
|
||||
self.add_template(ProjectFile(project_name.split('/')[-1], project_path, project_file_data))
|
||||
self.add_template(ProjectFile(project_name.split("/")[-1], project_path, project_file_data))
|
||||
if workspace is None:
|
||||
self.add_template(ProjectFileLicense(''))
|
||||
self.add_template(ProjectFileReadme(''))
|
||||
self.add_template(Init('', 'init', f'{base_path}tests/'))
|
||||
self.add_template(ProjectFileLicense(""))
|
||||
self.add_template(ProjectFileReadme(""))
|
||||
self.add_template(Init("", "init", f"{base_path}tests/"))
|
||||
|
||||
self.add_template(Init('', 'init', project_path))
|
||||
self.add_template(ProjectFileApplication(project_path, use_application_api, use_startup, use_service_providing, use_async))
|
||||
self.add_template(ProjectFileMain(project_name.split('/')[-1], project_path, use_application_api, use_startup, use_service_providing, use_async))
|
||||
self.add_template(ProjectFileTestCase(project_path, use_application_api, use_startup, use_service_providing, use_async))
|
||||
self.add_template(Init("", "init", project_path))
|
||||
self.add_template(
|
||||
ProjectFileApplication(project_path, use_application_api, use_startup, use_service_providing, use_async)
|
||||
)
|
||||
self.add_template(
|
||||
ProjectFileMain(
|
||||
project_name.split("/")[-1],
|
||||
project_path,
|
||||
use_application_api,
|
||||
use_startup,
|
||||
use_service_providing,
|
||||
use_async,
|
||||
)
|
||||
)
|
||||
self.add_template(
|
||||
ProjectFileTestCase(project_path, use_application_api, use_startup, use_service_providing, use_async)
|
||||
)
|
||||
|
||||
@@ -3,11 +3,10 @@ from cpl_core.utils import String
|
||||
|
||||
|
||||
class ABC(GenerateSchematicABC):
|
||||
|
||||
def __init__(self, name: str, schematic: str, path: str):
|
||||
GenerateSchematicABC.__init__(self, name, schematic, path)
|
||||
self._class_name = name
|
||||
if name != '':
|
||||
if name != "":
|
||||
self._class_name = f'{String.first_to_upper(name.replace(schematic, ""))}ABC'
|
||||
|
||||
def get_code(self) -> str:
|
||||
@@ -25,8 +24,4 @@ class ABC(GenerateSchematicABC):
|
||||
|
||||
@classmethod
|
||||
def register(cls):
|
||||
GenerateSchematicABC.register(
|
||||
cls,
|
||||
'abc',
|
||||
['a', 'A']
|
||||
)
|
||||
GenerateSchematicABC.register(cls, "abc", ["a", "A"])
|
||||
|
||||
@@ -4,7 +4,6 @@ from cpl_cli.abc.generate_schematic_abc import GenerateSchematicABC
|
||||
|
||||
|
||||
class Application(GenerateSchematicABC):
|
||||
|
||||
def __init__(self, *args: str):
|
||||
GenerateSchematicABC.__init__(self, *args)
|
||||
|
||||
@@ -32,8 +31,4 @@ class Application(GenerateSchematicABC):
|
||||
|
||||
@classmethod
|
||||
def register(cls):
|
||||
GenerateSchematicABC.register(
|
||||
cls,
|
||||
'application',
|
||||
['app', 'APP']
|
||||
)
|
||||
GenerateSchematicABC.register(cls, "application", ["app", "APP"])
|
||||
|
||||
@@ -4,7 +4,6 @@ from cpl_cli.abc.generate_schematic_abc import GenerateSchematicABC
|
||||
|
||||
|
||||
class ApplicationExtension(GenerateSchematicABC):
|
||||
|
||||
def __init__(self, *args: str):
|
||||
GenerateSchematicABC.__init__(self, *args)
|
||||
|
||||
@@ -28,8 +27,4 @@ class ApplicationExtension(GenerateSchematicABC):
|
||||
|
||||
@classmethod
|
||||
def register(cls):
|
||||
GenerateSchematicABC.register(
|
||||
cls,
|
||||
'application-extension',
|
||||
['appex', 'APPEX']
|
||||
)
|
||||
GenerateSchematicABC.register(cls, "application-extension", ["appex", "APPEX"])
|
||||
|
||||
@@ -3,11 +3,10 @@ from cpl_core.utils import String
|
||||
|
||||
|
||||
class Class(GenerateSchematicABC):
|
||||
|
||||
def __init__(self, name: str, schematic: str, path: str):
|
||||
GenerateSchematicABC.__init__(self, name, schematic, path)
|
||||
self._name = f'{String.convert_to_snake_case(name)}.py'
|
||||
self._class_name = f'{String.first_to_upper(name)}'
|
||||
self._name = f"{String.convert_to_snake_case(name)}.py"
|
||||
self._class_name = f"{String.first_to_upper(name)}"
|
||||
|
||||
def get_code(self) -> str:
|
||||
code = """\
|
||||
@@ -21,8 +20,4 @@ class Class(GenerateSchematicABC):
|
||||
|
||||
@classmethod
|
||||
def register(cls):
|
||||
GenerateSchematicABC.register(
|
||||
cls,
|
||||
'class',
|
||||
['c', 'C']
|
||||
)
|
||||
GenerateSchematicABC.register(cls, "class", ["c", "C"])
|
||||
|
||||
@@ -4,7 +4,6 @@ from cpl_cli.abc.generate_schematic_abc import GenerateSchematicABC
|
||||
|
||||
|
||||
class ConfigModel(GenerateSchematicABC):
|
||||
|
||||
def __init__(self, *args: str):
|
||||
GenerateSchematicABC.__init__(self, *args)
|
||||
|
||||
@@ -39,8 +38,4 @@ class ConfigModel(GenerateSchematicABC):
|
||||
|
||||
@classmethod
|
||||
def register(cls):
|
||||
GenerateSchematicABC.register(
|
||||
cls,
|
||||
'settings',
|
||||
['st', 'ST']
|
||||
)
|
||||
GenerateSchematicABC.register(cls, "settings", ["st", "ST"])
|
||||
|
||||
@@ -2,26 +2,24 @@ from cpl_cli.abc.generate_schematic_abc import GenerateSchematicABC
|
||||
|
||||
|
||||
class Enum(GenerateSchematicABC):
|
||||
|
||||
def __init__(self, *args: str):
|
||||
GenerateSchematicABC.__init__(self, *args)
|
||||
|
||||
def get_code(self) -> str:
|
||||
import textwrap
|
||||
code = textwrap.dedent("""\
|
||||
|
||||
code = textwrap.dedent(
|
||||
"""\
|
||||
from enum import Enum
|
||||
|
||||
|
||||
class $Name(Enum):
|
||||
|
||||
atr = 0
|
||||
""")
|
||||
"""
|
||||
)
|
||||
return self.build_code_str(code, Name=self._class_name)
|
||||
|
||||
@classmethod
|
||||
def register(cls):
|
||||
GenerateSchematicABC.register(
|
||||
cls,
|
||||
'enum',
|
||||
['e', 'E']
|
||||
)
|
||||
GenerateSchematicABC.register(cls, "enum", ["e", "E"])
|
||||
|
||||
@@ -4,10 +4,9 @@ from cpl_cli.abc.generate_schematic_abc import GenerateSchematicABC
|
||||
|
||||
|
||||
class Init(GenerateSchematicABC):
|
||||
|
||||
def __init__(self, *args: str):
|
||||
GenerateSchematicABC.__init__(self, *args)
|
||||
self._name = f'__init__.py'
|
||||
self._name = f"__init__.py"
|
||||
|
||||
def get_code(self) -> str:
|
||||
code = """\
|
||||
@@ -18,8 +17,4 @@ class Init(GenerateSchematicABC):
|
||||
|
||||
@classmethod
|
||||
def register(cls):
|
||||
GenerateSchematicABC.register(
|
||||
cls,
|
||||
'init',
|
||||
[]
|
||||
)
|
||||
GenerateSchematicABC.register(cls, "init", [])
|
||||
|
||||
@@ -4,7 +4,6 @@ from cpl_cli.abc.generate_schematic_abc import GenerateSchematicABC
|
||||
|
||||
|
||||
class Pipe(GenerateSchematicABC):
|
||||
|
||||
def __init__(self, *args: str):
|
||||
GenerateSchematicABC.__init__(self, *args)
|
||||
|
||||
@@ -25,8 +24,4 @@ class Pipe(GenerateSchematicABC):
|
||||
|
||||
@classmethod
|
||||
def register(cls):
|
||||
GenerateSchematicABC.register(
|
||||
cls,
|
||||
'pipe',
|
||||
['p', 'P']
|
||||
)
|
||||
GenerateSchematicABC.register(cls, "pipe", ["p", "P"])
|
||||
|
||||
@@ -3,11 +3,10 @@ from cpl_core.utils import String
|
||||
|
||||
|
||||
class Schematic(GenerateSchematicABC):
|
||||
|
||||
def __init__(self, name: str, path: str, schematic: str):
|
||||
GenerateSchematicABC.__init__(self, name, path, schematic)
|
||||
self._name = f'schematic_{String.convert_to_snake_case(name)}.py'
|
||||
self._path = '.cpl/'
|
||||
self._name = f"schematic_{String.convert_to_snake_case(name)}.py"
|
||||
self._path = ".cpl/"
|
||||
self._class_name = String.convert_to_camel_case(name)
|
||||
|
||||
def get_code(self) -> str:
|
||||
@@ -44,8 +43,4 @@ class Schematic(GenerateSchematicABC):
|
||||
|
||||
@classmethod
|
||||
def register(cls):
|
||||
GenerateSchematicABC.register(
|
||||
cls,
|
||||
'schematic',
|
||||
['scheme', 'SCHEME']
|
||||
)
|
||||
GenerateSchematicABC.register(cls, "schematic", ["scheme", "SCHEME"])
|
||||
|
||||
@@ -4,7 +4,6 @@ from cpl_cli.abc.generate_schematic_abc import GenerateSchematicABC
|
||||
|
||||
|
||||
class Service(GenerateSchematicABC):
|
||||
|
||||
def __init__(self, *args: str):
|
||||
GenerateSchematicABC.__init__(self, *args)
|
||||
|
||||
@@ -20,8 +19,4 @@ class Service(GenerateSchematicABC):
|
||||
|
||||
@classmethod
|
||||
def register(cls):
|
||||
GenerateSchematicABC.register(
|
||||
cls,
|
||||
'service',
|
||||
['s', 'S']
|
||||
)
|
||||
GenerateSchematicABC.register(cls, "service", ["s", "S"])
|
||||
|
||||
@@ -4,7 +4,6 @@ from cpl_cli.abc.generate_schematic_abc import GenerateSchematicABC
|
||||
|
||||
|
||||
class Startup(GenerateSchematicABC):
|
||||
|
||||
def __init__(self, *args: str):
|
||||
GenerateSchematicABC.__init__(self, *args)
|
||||
|
||||
@@ -32,8 +31,4 @@ class Startup(GenerateSchematicABC):
|
||||
|
||||
@classmethod
|
||||
def register(cls):
|
||||
GenerateSchematicABC.register(
|
||||
cls,
|
||||
'startup',
|
||||
['stup', 'STUP']
|
||||
)
|
||||
GenerateSchematicABC.register(cls, "startup", ["stup", "STUP"])
|
||||
|
||||
@@ -4,7 +4,6 @@ from cpl_cli.abc.generate_schematic_abc import GenerateSchematicABC
|
||||
|
||||
|
||||
class StartupExtension(GenerateSchematicABC):
|
||||
|
||||
def __init__(self, *args: str):
|
||||
GenerateSchematicABC.__init__(self, *args)
|
||||
|
||||
@@ -32,8 +31,4 @@ class StartupExtension(GenerateSchematicABC):
|
||||
|
||||
@classmethod
|
||||
def register(cls):
|
||||
GenerateSchematicABC.register(
|
||||
cls,
|
||||
'startup-extension',
|
||||
['stupex', 'STUPEX']
|
||||
)
|
||||
GenerateSchematicABC.register(cls, "startup-extension", ["stupex", "STUPEX"])
|
||||
|
||||
@@ -4,7 +4,6 @@ from cpl_cli.abc.generate_schematic_abc import GenerateSchematicABC
|
||||
|
||||
|
||||
class TestCase(GenerateSchematicABC):
|
||||
|
||||
def __init__(self, *args: str):
|
||||
GenerateSchematicABC.__init__(self, *args)
|
||||
|
||||
@@ -25,8 +24,4 @@ class TestCase(GenerateSchematicABC):
|
||||
|
||||
@classmethod
|
||||
def register(cls):
|
||||
GenerateSchematicABC.register(
|
||||
cls,
|
||||
'test-case',
|
||||
['tc', 'TC']
|
||||
)
|
||||
GenerateSchematicABC.register(cls, "test-case", ["tc", "TC"])
|
||||
|
||||
@@ -4,7 +4,6 @@ from cpl_cli.abc.generate_schematic_abc import GenerateSchematicABC
|
||||
|
||||
|
||||
class Thread(GenerateSchematicABC):
|
||||
|
||||
def __init__(self, *args: str):
|
||||
GenerateSchematicABC.__init__(self, *args)
|
||||
|
||||
@@ -26,8 +25,4 @@ class Thread(GenerateSchematicABC):
|
||||
|
||||
@classmethod
|
||||
def register(cls):
|
||||
GenerateSchematicABC.register(
|
||||
cls,
|
||||
'thread',
|
||||
['t', 'T']
|
||||
)
|
||||
GenerateSchematicABC.register(cls, "thread", ["t", "T"])
|
||||
|
||||
@@ -4,7 +4,6 @@ from cpl_cli.abc.generate_schematic_abc import GenerateSchematicABC
|
||||
|
||||
|
||||
class Validator(GenerateSchematicABC):
|
||||
|
||||
def __init__(self, *args: str):
|
||||
GenerateSchematicABC.__init__(self, *args)
|
||||
|
||||
@@ -26,8 +25,4 @@ class Validator(GenerateSchematicABC):
|
||||
|
||||
@classmethod
|
||||
def register(cls):
|
||||
GenerateSchematicABC.register(
|
||||
cls,
|
||||
'validator',
|
||||
['v', 'V']
|
||||
)
|
||||
GenerateSchematicABC.register(cls, "validator", ["v", "V"])
|
||||
|
||||
Reference in New Issue
Block a user