Added generate abc command
This commit is contained in:
0
src/cpl_cli/templates/generate/__init__.py
Normal file
0
src/cpl_cli/templates/generate/__init__.py
Normal file
22
src/cpl_cli/templates/generate/abc_template.py
Normal file
22
src/cpl_cli/templates/generate/abc_template.py
Normal file
@@ -0,0 +1,22 @@
|
||||
import textwrap
|
||||
from string import Template
|
||||
|
||||
|
||||
class ABCTemplate:
|
||||
|
||||
@staticmethod
|
||||
def get_abc_py(name: str) -> str:
|
||||
string = textwrap.dedent("""\
|
||||
from abc import ABC, abstractmethod
|
||||
|
||||
|
||||
class $Name(ABC):
|
||||
|
||||
@abstractmethod
|
||||
def __init__(self): pass
|
||||
|
||||
""")
|
||||
|
||||
return Template(string).substitute(
|
||||
Name=name
|
||||
)
|
Reference in New Issue
Block a user