From b377710931f45de008ab540e2b680a4e7fc17587 Mon Sep 17 00:00:00 2001 From: Sven Heidemann Date: Wed, 10 Mar 2021 17:04:53 +0100 Subject: [PATCH] Improved new console command --- src/cpl_cli/command/new.py | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/src/cpl_cli/command/new.py b/src/cpl_cli/command/new.py index 72bd8486..a0801261 100644 --- a/src/cpl_cli/command/new.py +++ b/src/cpl_cli/command/new.py @@ -1,10 +1,12 @@ import json import os import sys +import time from typing import Optional from cpl.application.application_runtime_abc import ApplicationRuntimeABC from cpl.configuration.configuration_abc import ConfigurationABC +from cpl.console.foreground_color import ForegroundColor from cpl.console.console import Console from cpl_cli.command_abc import CommandABC from cpl_cli.configuration.build_settings import BuildSettings @@ -95,6 +97,7 @@ class New(CommandABC): return project_path def _get_project_informations(self): + Console.set_foreground_color(ForegroundColor.green) result = Console.read('Do you want to use application host? (y/n) ') if result.lower() == 'y': self._use_application_api = True @@ -104,6 +107,8 @@ class New(CommandABC): if result.lower() == 'y': self._use_startup = True + Console.set_foreground_color(ForegroundColor.default) + # else: # result = Console.read('Do you want to use service providing? (y/n) ') # if result.lower() == 'y': @@ -133,7 +138,14 @@ class New(CommandABC): templates.append(MainWithoutApplicationHostTemplate()) 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 def _create_template(project_path: str, template: TemplateFileABC): @@ -150,14 +162,12 @@ class New(CommandABC): def _console(self, args: list[str]): name = self._config.get_configuration(self._command) - Console.spinner('Creating project settings', self._create_project_settings, name) - Console.spinner('Creating build settings', self._create_build_settings) + self._create_project_settings(name) + self._create_build_settings() path = self._get_project_path() if path is None: return - Console.spinner('Creating project file', self._create_project_json) - Console.write_line('Building project directory:') self._get_project_informations() try: self._build_project_dir(path)