Added workspace handling for new command
This commit is contained in:
@@ -1,25 +0,0 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
"""
|
||||
sh_cpl-cli sh-edraft Common Python library CLI
|
||||
~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
sh-edraft Common Python library Command Line Interface
|
||||
|
||||
:copyright: (c) 2020 - 2021 sh-edraft.de
|
||||
:license: MIT, see LICENSE for more details.
|
||||
|
||||
"""
|
||||
|
||||
__title__ = 'cpl_cli.templates.new.library.cli'
|
||||
__author__ = 'Sven Heidemann'
|
||||
__license__ = 'MIT'
|
||||
__copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de'
|
||||
__version__ = '2021.4'
|
||||
|
||||
from collections import namedtuple
|
||||
|
||||
# imports:
|
||||
|
||||
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
|
||||
version_info = VersionInfo(major='2021', minor='4', micro='None')
|
@@ -1,29 +0,0 @@
|
||||
import textwrap
|
||||
|
||||
from cpl.utils.string import String
|
||||
from cpl_cli.templates.template_file_abc import TemplateFileABC
|
||||
|
||||
|
||||
class CLIInitTemplate(TemplateFileABC):
|
||||
|
||||
def __init__(self, name: str):
|
||||
TemplateFileABC.__init__(self)
|
||||
|
||||
name = String.convert_to_snake_case(name)
|
||||
self._name = '__init__.py'
|
||||
self._path = f'src/{name}_cli/'
|
||||
self._value = textwrap.dedent("""\
|
||||
# imports:
|
||||
""")
|
||||
|
||||
@property
|
||||
def name(self) -> str:
|
||||
return self._name
|
||||
|
||||
@property
|
||||
def path(self) -> str:
|
||||
return self._path
|
||||
|
||||
@property
|
||||
def value(self) -> str:
|
||||
return self._value
|
@@ -11,7 +11,7 @@ class ApplicationTemplate(TemplateFileABC):
|
||||
|
||||
name = String.convert_to_snake_case(name)
|
||||
self._name = 'application.py'
|
||||
self._path = f'src/{name}_cli/'
|
||||
self._path = f'src/{name}/'
|
||||
self._value = textwrap.dedent("""\
|
||||
from cpl.application import ApplicationABC
|
||||
from cpl.configuration import ConfigurationABC
|
@@ -1,13 +1,15 @@
|
||||
import textwrap
|
||||
|
||||
from cpl.utils.string import String
|
||||
from cpl_cli.templates.template_file_abc import TemplateFileABC
|
||||
|
||||
|
||||
class TestsInitTemplate(TemplateFileABC):
|
||||
class NameInitTemplate(TemplateFileABC):
|
||||
|
||||
def __init__(self, name: str):
|
||||
TemplateFileABC.__init__(self)
|
||||
|
||||
name = String.convert_to_snake_case(name)
|
||||
self._name = '__init__.py'
|
||||
self._path = f'src/{name}/'
|
||||
self._value = textwrap.dedent("""\
|
||||
|
@@ -11,12 +11,12 @@ class MainWithApplicationHostAndStartupTemplate(TemplateFileABC):
|
||||
|
||||
name = String.convert_to_snake_case(name)
|
||||
self._name = 'main.py'
|
||||
self._path = f'src/{name}_cli/'
|
||||
self._path = f'src/{name}/'
|
||||
self._value = textwrap.dedent(f"""\
|
||||
from cpl.application import ApplicationBuilder
|
||||
|
||||
from {name}_cli.application import Application
|
||||
from {name}_cli.startup import Startup
|
||||
from {name}.application import Application
|
||||
from {name}.startup import Startup
|
||||
|
||||
|
||||
def main():
|
||||
@@ -44,15 +44,16 @@ class MainWithApplicationHostAndStartupTemplate(TemplateFileABC):
|
||||
|
||||
class MainWithApplicationBaseTemplate(TemplateFileABC):
|
||||
|
||||
def __init__(self):
|
||||
def __init__(self, name: str):
|
||||
TemplateFileABC.__init__(self)
|
||||
|
||||
name = String.convert_to_snake_case(name)
|
||||
self._name = 'main.py'
|
||||
self._path = 'src/'
|
||||
self._value = textwrap.dedent(f"""\
|
||||
from cpl.application import ApplicationBuilder
|
||||
|
||||
from {name}_cli.application import Application
|
||||
from {name}.application import Application
|
||||
|
||||
|
||||
def main():
|
@@ -11,7 +11,7 @@ class StartupTemplate(TemplateFileABC):
|
||||
|
||||
name = String.convert_to_snake_case(name)
|
||||
self._name = 'startup.py'
|
||||
self._path = f'src/{name}_cli/'
|
||||
self._path = f'src/{name}/'
|
||||
self._value = textwrap.dedent("""\
|
||||
from cpl.application import StartupABC
|
||||
from cpl.configuration import ConfigurationABC
|
Reference in New Issue
Block a user