Improved new command to use workspace when found

This commit is contained in:
2021-04-09 22:09:55 +02:00
parent d19c47e571
commit 7ad01d4bdd
8 changed files with 105 additions and 59 deletions

View File

@@ -1,3 +1,4 @@
import os
import textwrap
from cpl.utils.string import String
@@ -6,12 +7,12 @@ from cpl_cli.templates.template_file_abc import TemplateFileABC
class NameInitTemplate(TemplateFileABC):
def __init__(self, name: str):
def __init__(self, name: str, path: str):
TemplateFileABC.__init__(self)
name = String.convert_to_snake_case(name)
self._name = '__init__.py'
self._path = f'src/{name}/'
self._path = os.path.join(path, name)
self._value = textwrap.dedent("""\
# imports:
""")