2021.4.1 #11

Merged
edraft merged 172 commits from 2021.04.01 into 2021.04 2021-03-21 20:04:24 +01:00
Showing only changes of commit b377710931 - Show all commits

View File

@ -1,10 +1,12 @@
import json import json
import os import os
import sys import sys
import time
from typing import Optional from typing import Optional
from cpl.application.application_runtime_abc import ApplicationRuntimeABC from cpl.application.application_runtime_abc import ApplicationRuntimeABC
from cpl.configuration.configuration_abc import ConfigurationABC from cpl.configuration.configuration_abc import ConfigurationABC
from cpl.console.foreground_color import ForegroundColor
from cpl.console.console import Console from cpl.console.console import Console
from cpl_cli.command_abc import CommandABC from cpl_cli.command_abc import CommandABC
from cpl_cli.configuration.build_settings import BuildSettings from cpl_cli.configuration.build_settings import BuildSettings
@ -95,6 +97,7 @@ class New(CommandABC):
return project_path return project_path
def _get_project_informations(self): def _get_project_informations(self):
Console.set_foreground_color(ForegroundColor.green)
result = Console.read('Do you want to use application host? (y/n) ') result = Console.read('Do you want to use application host? (y/n) ')
if result.lower() == 'y': if result.lower() == 'y':
self._use_application_api = True self._use_application_api = True
@ -104,6 +107,8 @@ class New(CommandABC):
if result.lower() == 'y': if result.lower() == 'y':
self._use_startup = True self._use_startup = True
Console.set_foreground_color(ForegroundColor.default)
# else: # else:
# result = Console.read('Do you want to use service providing? (y/n) ') # result = Console.read('Do you want to use service providing? (y/n) ')
# if result.lower() == 'y': # if result.lower() == 'y':
@ -133,7 +138,14 @@ class New(CommandABC):
templates.append(MainWithoutApplicationHostTemplate()) templates.append(MainWithoutApplicationHostTemplate())
for template in templates: for template in templates:
Console.spinner(f'Creating {template.path}{template.name}', self._create_template, project_path, template) Console.spinner(
f'Creating {self._project.name}/{template.path}{template.name}',
self._create_template,
project_path,
template,
text_foreground_color=ForegroundColor.green,
spinner_foreground_color=ForegroundColor.cyan
)
@staticmethod @staticmethod
def _create_template(project_path: str, template: TemplateFileABC): def _create_template(project_path: str, template: TemplateFileABC):
@ -150,14 +162,12 @@ class New(CommandABC):
def _console(self, args: list[str]): def _console(self, args: list[str]):
name = self._config.get_configuration(self._command) name = self._config.get_configuration(self._command)
Console.spinner('Creating project settings', self._create_project_settings, name) self._create_project_settings(name)
Console.spinner('Creating build settings', self._create_build_settings) self._create_build_settings()
path = self._get_project_path() path = self._get_project_path()
if path is None: if path is None:
return return
Console.spinner('Creating project file', self._create_project_json)
Console.write_line('Building project directory:')
self._get_project_informations() self._get_project_informations()
try: try:
self._build_project_dir(path) self._build_project_dir(path)