Improved new command
This commit is contained in:
parent
8ddfd35a82
commit
260fe06be8
@ -16,6 +16,7 @@ from cpl_cli.configuration.build_settings_name_enum import BuildSettingsNameEnum
|
|||||||
from cpl_cli.configuration.project_settings import ProjectSettings
|
from cpl_cli.configuration.project_settings import ProjectSettings
|
||||||
from cpl_cli.configuration.project_settings_name_enum import ProjectSettingsNameEnum
|
from cpl_cli.configuration.project_settings_name_enum import ProjectSettingsNameEnum
|
||||||
from cpl_cli.configuration.version_settings_name_enum import VersionSettingsNameEnum
|
from cpl_cli.configuration.version_settings_name_enum import VersionSettingsNameEnum
|
||||||
|
from cpl_cli.templates.new.console.appsettings_json import AppsettingsTemplate
|
||||||
from cpl_cli.templates.new.console.license import LicenseTemplate
|
from cpl_cli.templates.new.console.license import LicenseTemplate
|
||||||
from cpl_cli.templates.new.console.readme_py import ReadmeTemplate
|
from cpl_cli.templates.new.console.readme_py import ReadmeTemplate
|
||||||
from cpl_cli.templates.new.console.src.application import ApplicationTemplate
|
from cpl_cli.templates.new.console.src.application import ApplicationTemplate
|
||||||
@ -142,14 +143,13 @@ class NewService(CommandABC):
|
|||||||
if result.lower() == 'y':
|
if result.lower() == 'y':
|
||||||
self._use_application_api = True
|
self._use_application_api = True
|
||||||
|
|
||||||
result = Console.read('Do you want to use service providing? (y/n) ')
|
result = Console.read('Do you want to use startup? (y/n) ')
|
||||||
if result.lower() == 'y':
|
if result.lower() == 'y':
|
||||||
self._use_service_providing = True
|
self._use_startup = True
|
||||||
|
else:
|
||||||
if self._use_application_api:
|
result = Console.read('Do you want to use service providing? (y/n) ')
|
||||||
result = Console.read('Do you want to use startup? (y/n) ')
|
if result.lower() == 'y':
|
||||||
if result.lower() == 'y':
|
self._use_service_providing = True
|
||||||
self._use_startup = True
|
|
||||||
|
|
||||||
Console.set_foreground_color(ForegroundColorEnum.default)
|
Console.set_foreground_color(ForegroundColorEnum.default)
|
||||||
|
|
||||||
@ -169,7 +169,8 @@ class NewService(CommandABC):
|
|||||||
templates: list[TemplateFileABC] = [
|
templates: list[TemplateFileABC] = [
|
||||||
LicenseTemplate(),
|
LicenseTemplate(),
|
||||||
ReadmeTemplate(),
|
ReadmeTemplate(),
|
||||||
TestsInitTemplate()
|
TestsInitTemplate(),
|
||||||
|
AppsettingsTemplate()
|
||||||
]
|
]
|
||||||
|
|
||||||
if self._use_application_api:
|
if self._use_application_api:
|
||||||
|
41
src/cpl_cli/templates/new/console/appsettings_json.py
Normal file
41
src/cpl_cli/templates/new/console/appsettings_json.py
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
import textwrap
|
||||||
|
|
||||||
|
from cpl_cli.templates.template_file_abc import TemplateFileABC
|
||||||
|
|
||||||
|
|
||||||
|
class AppsettingsTemplate(TemplateFileABC):
|
||||||
|
|
||||||
|
def __init__(self):
|
||||||
|
TemplateFileABC.__init__(self)
|
||||||
|
|
||||||
|
self._name = 'appsettings.json'
|
||||||
|
self._path = ''
|
||||||
|
self._value = textwrap.dedent("""\
|
||||||
|
{
|
||||||
|
"TimeFormatSettings": {
|
||||||
|
"DateFormat": "%Y-%m-%d",
|
||||||
|
"TimeFormat": "%H:%M:%S",
|
||||||
|
"DateTimeFormat": "%Y-%m-%d %H:%M:%S.%f",
|
||||||
|
"DateTimeLogFormat": "%Y-%m-%d_%H-%M-%S"
|
||||||
|
},
|
||||||
|
|
||||||
|
"LoggingSettings": {
|
||||||
|
"Path": "logs/",
|
||||||
|
"Filename": "log_$start_time.log",
|
||||||
|
"ConsoleLogLevel": "ERROR",
|
||||||
|
"FileLogLevel": "WARN"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
""")
|
||||||
|
|
||||||
|
@property
|
||||||
|
def name(self) -> str:
|
||||||
|
return self._name
|
||||||
|
|
||||||
|
@property
|
||||||
|
def path(self) -> str:
|
||||||
|
return self._path
|
||||||
|
|
||||||
|
@property
|
||||||
|
def value(self) -> str:
|
||||||
|
return self._value
|
Loading…
Reference in New Issue
Block a user