Renamed by internal conventions
This commit is contained in:
@@ -22,7 +22,7 @@ from collections import namedtuple
|
||||
# imports:
|
||||
from .cli import CLI
|
||||
from .command_abc import CommandABC
|
||||
from .command_handler import CommandHandler
|
||||
from .command_handler_service import CommandHandler
|
||||
from .command_model import CommandModel
|
||||
from .error import Error
|
||||
from .main import main
|
||||
|
@@ -1,15 +1,15 @@
|
||||
from typing import Optional
|
||||
|
||||
from cpl.application.application_abc import ApplicationABC
|
||||
from cpl_cli.command.build import Build
|
||||
from cpl_cli.command.generate import Generate
|
||||
from cpl_cli.command.new import New
|
||||
from cpl_cli.command.publish import Publish
|
||||
from cpl_cli.command_handler import CommandHandler
|
||||
from cpl_cli.command.build_service import BuildService
|
||||
from cpl_cli.command.generate_service import GenerateService
|
||||
from cpl_cli.command.new_service import NewService
|
||||
from cpl_cli.command.publish_service import PublishService
|
||||
from cpl_cli.command_handler_service import CommandHandler
|
||||
from cpl_cli.command_model import CommandModel
|
||||
from cpl_cli.error import Error
|
||||
from cpl_cli.command.help import Help
|
||||
from cpl_cli.command.version import Version
|
||||
from cpl_cli.command.help_service import HelpService
|
||||
from cpl_cli.command.version_service import VersionService
|
||||
|
||||
|
||||
class CLI(ApplicationABC):
|
||||
@@ -22,12 +22,12 @@ class CLI(ApplicationABC):
|
||||
def configure(self):
|
||||
self._command_handler: CommandHandler = self._services.get_service(CommandHandler)
|
||||
|
||||
self._command_handler.add_command(CommandModel('build', ['h', 'B'], Build, True))
|
||||
self._command_handler.add_command(CommandModel('generate', ['g', 'G'], Generate, True))
|
||||
self._command_handler.add_command(CommandModel('help', ['h', 'H'], Help, False))
|
||||
self._command_handler.add_command(CommandModel('new', ['n', 'N'], New, False))
|
||||
self._command_handler.add_command(CommandModel('publish', ['p', 'P'], Publish, True))
|
||||
self._command_handler.add_command(CommandModel('version', ['v', 'V'], Version, False))
|
||||
self._command_handler.add_command(CommandModel('build', ['h', 'B'], BuildService, True))
|
||||
self._command_handler.add_command(CommandModel('generate', ['g', 'G'], GenerateService, True))
|
||||
self._command_handler.add_command(CommandModel('help', ['h', 'H'], HelpService, False))
|
||||
self._command_handler.add_command(CommandModel('new', ['n', 'N'], NewService, False))
|
||||
self._command_handler.add_command(CommandModel('publish', ['p', 'P'], PublishService, True))
|
||||
self._command_handler.add_command(CommandModel('version', ['v', 'V'], VersionService, False))
|
||||
|
||||
def main(self):
|
||||
if len(self._configuration.additional_arguments) < 1:
|
||||
|
@@ -3,7 +3,7 @@ from cpl_cli.command_abc import CommandABC
|
||||
from cpl_cli.publish.publisher_abc import PublisherABC
|
||||
|
||||
|
||||
class Build(CommandABC):
|
||||
class BuildService(CommandABC):
|
||||
|
||||
def __init__(self, publisher: PublisherABC):
|
||||
CommandABC.__init__(self)
|
@@ -3,7 +3,7 @@ from collections import Callable
|
||||
|
||||
from cpl.application.application_abc import ApplicationRuntimeABC
|
||||
from cpl.configuration.configuration_abc import ConfigurationABC
|
||||
from cpl.console.foreground_color_enum import ForegroundColor
|
||||
from cpl.console.foreground_color_enum import ForegroundColorEnum
|
||||
from cpl.console.console import Console
|
||||
from cpl.utils.string import String
|
||||
from cpl_cli.command_abc import CommandABC
|
||||
@@ -16,7 +16,7 @@ from cpl_cli.templates.generate.thread_template import ThreadTemplate
|
||||
from cpl_cli.templates.template_file_abc import TemplateFileABC
|
||||
|
||||
|
||||
class Generate(CommandABC):
|
||||
class GenerateService(CommandABC):
|
||||
|
||||
def __init__(self, configuration: ConfigurationABC, runtime: ApplicationRuntimeABC):
|
||||
CommandABC.__init__(self)
|
||||
@@ -99,8 +99,8 @@ class Generate(CommandABC):
|
||||
self._create_file,
|
||||
file_path,
|
||||
template.value,
|
||||
text_foreground_color=ForegroundColor.green,
|
||||
spinner_foreground_color=ForegroundColor.cyan
|
||||
text_foreground_color=ForegroundColorEnum.green,
|
||||
spinner_foreground_color=ForegroundColorEnum.cyan
|
||||
)
|
||||
|
||||
def run(self, args: list[str]):
|
@@ -1,9 +1,9 @@
|
||||
from cpl.console.console import Console
|
||||
from cpl.console.foreground_color_enum import ForegroundColor
|
||||
from cpl.console.foreground_color_enum import ForegroundColorEnum
|
||||
from cpl_cli.command_abc import CommandABC
|
||||
|
||||
|
||||
class Help(CommandABC):
|
||||
class HelpService(CommandABC):
|
||||
|
||||
def __init__(self):
|
||||
CommandABC.__init__(self)
|
||||
@@ -21,9 +21,9 @@ class Help(CommandABC):
|
||||
['version (v|V)', 'Outputs CPL CLI version.']
|
||||
]
|
||||
for name, description in commands:
|
||||
Console.set_foreground_color(ForegroundColor.blue)
|
||||
Console.set_foreground_color(ForegroundColorEnum.blue)
|
||||
Console.write(f'\n\t{name} ')
|
||||
Console.set_foreground_color(ForegroundColor.default)
|
||||
Console.set_foreground_color(ForegroundColorEnum.default)
|
||||
Console.write(f'{description}')
|
||||
|
||||
Console.write('\n')
|
@@ -6,14 +6,14 @@ from typing import Optional
|
||||
|
||||
from cpl.application.application_runtime_abc import ApplicationRuntimeABC
|
||||
from cpl.configuration.configuration_abc import ConfigurationABC
|
||||
from cpl.console.foreground_color_enum import ForegroundColor
|
||||
from cpl.console.foreground_color_enum import ForegroundColorEnum
|
||||
from cpl.console.console import Console
|
||||
from cpl_cli.command_abc import CommandABC
|
||||
from cpl_cli.configuration.build_settings import BuildSettings
|
||||
from cpl_cli.configuration.build_settings_name import BuildSettingsName
|
||||
from cpl_cli.configuration.build_settings_name_enum import BuildSettingsName
|
||||
from cpl_cli.configuration.project_settings import ProjectSettings
|
||||
from cpl_cli.configuration.project_settings_name import ProjectSettingsName
|
||||
from cpl_cli.configuration.version_settings_name import VersionSettingsName
|
||||
from cpl_cli.configuration.project_settings_name_enum import ProjectSettingsName
|
||||
from cpl_cli.configuration.version_settings_name_enum import VersionSettingsName
|
||||
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.src.application import ApplicationTemplate
|
||||
@@ -23,7 +23,7 @@ from cpl_cli.templates.new.console.src.tests.init import TestsInitTemplate
|
||||
from cpl_cli.templates.template_file_abc import TemplateFileABC
|
||||
|
||||
|
||||
class New(CommandABC):
|
||||
class NewService(CommandABC):
|
||||
|
||||
def __init__(self, configuration: ConfigurationABC, runtime: ApplicationRuntimeABC):
|
||||
CommandABC.__init__(self)
|
||||
@@ -106,7 +106,7 @@ class New(CommandABC):
|
||||
if result.lower() == 'y':
|
||||
self._use_startup = True
|
||||
|
||||
Console.set_foreground_color(ForegroundColor.default)
|
||||
Console.set_foreground_color(ForegroundColorEnum.default)
|
||||
|
||||
# else:
|
||||
# result = Console.read('Do you want to use service providing? (y/n) ')
|
||||
@@ -142,8 +142,8 @@ class New(CommandABC):
|
||||
self._create_template,
|
||||
project_path,
|
||||
template,
|
||||
text_foreground_color=ForegroundColor.green,
|
||||
spinner_foreground_color=ForegroundColor.cyan
|
||||
text_foreground_color=ForegroundColorEnum.green,
|
||||
spinner_foreground_color=ForegroundColorEnum.cyan
|
||||
)
|
||||
|
||||
@staticmethod
|
@@ -3,7 +3,7 @@ from cpl_cli.command_abc import CommandABC
|
||||
from cpl_cli.publish.publisher_abc import PublisherABC
|
||||
|
||||
|
||||
class Publish(CommandABC):
|
||||
class PublishService(CommandABC):
|
||||
|
||||
def __init__(self, publisher: PublisherABC):
|
||||
CommandABC.__init__(self)
|
@@ -7,19 +7,19 @@ import pkg_resources
|
||||
import cpl
|
||||
import cpl_cli
|
||||
from cpl.console.console import Console
|
||||
from cpl.console.foreground_color_enum import ForegroundColor
|
||||
from cpl.console.foreground_color_enum import ForegroundColorEnum
|
||||
from cpl_cli.command_abc import CommandABC
|
||||
|
||||
|
||||
class Version(CommandABC):
|
||||
class VersionService(CommandABC):
|
||||
|
||||
def __init__(self):
|
||||
CommandABC.__init__(self)
|
||||
|
||||
def run(self, args: list[str]):
|
||||
Console.set_foreground_color(ForegroundColor.yellow)
|
||||
Console.set_foreground_color(ForegroundColorEnum.yellow)
|
||||
Console.banner('CPL CLI')
|
||||
Console.set_foreground_color(ForegroundColor.default)
|
||||
Console.set_foreground_color(ForegroundColorEnum.default)
|
||||
if '__version__' in dir(cpl_cli):
|
||||
Console.write_line(f'Common Python library CLI: ')
|
||||
Console.write(cpl_cli.__version__)
|
@@ -3,8 +3,8 @@ from typing import Optional
|
||||
|
||||
from cpl.configuration.configuration_model_abc import ConfigurationModelABC
|
||||
from cpl.console.console import Console
|
||||
from cpl.console.foreground_color_enum import ForegroundColor
|
||||
from cpl_cli.configuration.build_settings_name import BuildSettingsName
|
||||
from cpl.console.foreground_color_enum import ForegroundColorEnum
|
||||
from cpl_cli.configuration.build_settings_name_enum import BuildSettingsName
|
||||
|
||||
|
||||
class BuildSettings(ConfigurationModelABC):
|
||||
@@ -64,8 +64,8 @@ class BuildSettings(ConfigurationModelABC):
|
||||
self._excluded = settings[BuildSettingsName.excluded.value]
|
||||
self._package_data = settings[BuildSettingsName.package_data.value]
|
||||
except Exception as e:
|
||||
Console.set_foreground_color(ForegroundColor.red)
|
||||
Console.set_foreground_color(ForegroundColorEnum.red)
|
||||
Console.write_line(
|
||||
f'[ ERROR ] [ {__name__} ]: Reading error in {BuildSettings.__name__} settings')
|
||||
Console.write_line(f'[ EXCEPTION ] [ {__name__} ]: {e} -> {traceback.format_exc()}')
|
||||
Console.set_foreground_color(ForegroundColor.default)
|
||||
Console.set_foreground_color(ForegroundColorEnum.default)
|
||||
|
@@ -3,9 +3,9 @@ from typing import Optional
|
||||
|
||||
from cpl.configuration.configuration_model_abc import ConfigurationModelABC
|
||||
from cpl.console.console import Console
|
||||
from cpl.console.foreground_color_enum import ForegroundColor
|
||||
from cpl_cli.configuration.version import Version
|
||||
from cpl_cli.configuration.project_settings_name import ProjectSettingsName
|
||||
from cpl.console.foreground_color_enum import ForegroundColorEnum
|
||||
from cpl_cli.configuration.version_settings import VersionSettings
|
||||
from cpl_cli.configuration.project_settings_name_enum import ProjectSettingsName
|
||||
|
||||
|
||||
class ProjectSettings(ConfigurationModelABC):
|
||||
@@ -14,7 +14,7 @@ class ProjectSettings(ConfigurationModelABC):
|
||||
ConfigurationModelABC.__init__(self)
|
||||
|
||||
self._name: Optional[str] = None
|
||||
self._version: Optional[Version] = Version()
|
||||
self._version: Optional[VersionSettings] = VersionSettings()
|
||||
self._author: Optional[str] = None
|
||||
self._author_email: Optional[str] = None
|
||||
self._description: Optional[str] = None
|
||||
@@ -32,7 +32,7 @@ class ProjectSettings(ConfigurationModelABC):
|
||||
return self._name
|
||||
|
||||
@property
|
||||
def version(self) -> Version:
|
||||
def version(self) -> VersionSettings:
|
||||
return self._version
|
||||
|
||||
@property
|
||||
@@ -95,8 +95,8 @@ class ProjectSettings(ConfigurationModelABC):
|
||||
self._dependencies = settings[ProjectSettingsName.dependencies.value]
|
||||
self._python_version = settings[ProjectSettingsName.python_version.value]
|
||||
except Exception as e:
|
||||
Console.set_foreground_color(ForegroundColor.red)
|
||||
Console.set_foreground_color(ForegroundColorEnum.red)
|
||||
Console.write_line(
|
||||
f'[ ERROR ] [ {__name__} ]: Reading error in {ProjectSettings.__name__} settings')
|
||||
Console.write_line(f'[ EXCEPTION ] [ {__name__} ]: {e} -> {traceback.format_exc()}')
|
||||
Console.set_foreground_color(ForegroundColor.default)
|
||||
Console.set_foreground_color(ForegroundColorEnum.default)
|
||||
|
@@ -1,10 +1,10 @@
|
||||
from typing import Optional
|
||||
|
||||
from cpl.configuration.configuration_model_abc import ConfigurationModelABC
|
||||
from cpl_cli.configuration.version_settings_name import VersionSettingsName
|
||||
from cpl_cli.configuration.version_settings_name_enum import VersionSettingsName
|
||||
|
||||
|
||||
class Version(ConfigurationModelABC):
|
||||
class VersionSettings(ConfigurationModelABC):
|
||||
|
||||
def __init__(
|
||||
self,
|
@@ -7,7 +7,7 @@ import setuptools
|
||||
from setuptools import sandbox
|
||||
|
||||
from cpl.application.application_runtime_abc import ApplicationRuntimeABC
|
||||
from cpl.console.foreground_color_enum import ForegroundColor
|
||||
from cpl.console.foreground_color_enum import ForegroundColorEnum
|
||||
from cpl.console.console import Console
|
||||
from cpl_cli.configuration.build_settings import BuildSettings
|
||||
from cpl_cli.configuration.project_settings import ProjectSettings
|
||||
@@ -299,20 +299,20 @@ class Publisher(PublisherABC):
|
||||
def build(self):
|
||||
self._output_path = os.path.join(self._output_path, 'build')
|
||||
|
||||
Console.spinner('Reading source files:', self._read_sources, text_foreground_color=ForegroundColor.green, spinner_foreground_color=ForegroundColor.blue)
|
||||
Console.spinner('Creating internal packages:', self._create_packages, text_foreground_color=ForegroundColor.green, spinner_foreground_color=ForegroundColor.blue)
|
||||
Console.spinner('Building application:', self._dist_files, text_foreground_color=ForegroundColor.green, spinner_foreground_color=ForegroundColor.blue)
|
||||
Console.spinner('Reading source files:', self._read_sources, text_foreground_color=ForegroundColorEnum.green, spinner_foreground_color=ForegroundColorEnum.blue)
|
||||
Console.spinner('Creating internal packages:', self._create_packages, text_foreground_color=ForegroundColorEnum.green, spinner_foreground_color=ForegroundColorEnum.blue)
|
||||
Console.spinner('Building application:', self._dist_files, text_foreground_color=ForegroundColorEnum.green, spinner_foreground_color=ForegroundColorEnum.blue)
|
||||
|
||||
def publish(self):
|
||||
self._output_path = os.path.join(self._output_path, 'publish')
|
||||
|
||||
Console.write_line('Build:')
|
||||
Console.spinner('Reading source files:', self._read_sources, text_foreground_color=ForegroundColor.green, spinner_foreground_color=ForegroundColor.blue)
|
||||
Console.spinner('Creating internal packages:', self._create_packages, text_foreground_color=ForegroundColor.green, spinner_foreground_color=ForegroundColor.blue)
|
||||
Console.spinner('Building application:', self._dist_files, text_foreground_color=ForegroundColor.green, spinner_foreground_color=ForegroundColor.blue)
|
||||
Console.spinner('Reading source files:', self._read_sources, text_foreground_color=ForegroundColorEnum.green, spinner_foreground_color=ForegroundColorEnum.blue)
|
||||
Console.spinner('Creating internal packages:', self._create_packages, text_foreground_color=ForegroundColorEnum.green, spinner_foreground_color=ForegroundColorEnum.blue)
|
||||
Console.spinner('Building application:', self._dist_files, text_foreground_color=ForegroundColorEnum.green, spinner_foreground_color=ForegroundColorEnum.blue)
|
||||
|
||||
Console.write_line('\nPublish:')
|
||||
Console.spinner('Generating setup_template.py:', self._create_setup, text_foreground_color=ForegroundColor.green, spinner_foreground_color=ForegroundColor.blue)
|
||||
Console.spinner('Generating setup_template.py:', self._create_setup, text_foreground_color=ForegroundColorEnum.green, spinner_foreground_color=ForegroundColorEnum.blue)
|
||||
Console.write_line('Running setup_template.py:\n')
|
||||
self._run_setup()
|
||||
# Console.spinner('Cleaning dist path:', self._clean_dist_files)
|
@@ -6,15 +6,15 @@ from cpl.application.startup_abc import StartupABC
|
||||
from cpl.configuration.console_argument import ConsoleArgument
|
||||
from cpl.configuration.configuration_abc import ConfigurationABC
|
||||
from cpl.dependency_injection.service_provider_abc import ServiceProviderABC
|
||||
from cpl_cli.command.build import Build
|
||||
from cpl_cli.command.generate import Generate
|
||||
from cpl_cli.command.new import New
|
||||
from cpl_cli.command.publish import Publish
|
||||
from cpl_cli.command_handler import CommandHandler
|
||||
from cpl_cli.command.help import Help
|
||||
from cpl_cli.command.version import Version
|
||||
from cpl_cli.command.build_service import BuildService
|
||||
from cpl_cli.command.generate_service import GenerateService
|
||||
from cpl_cli.command.new_service import NewService
|
||||
from cpl_cli.command.publish_service import PublishService
|
||||
from cpl_cli.command_handler_service import CommandHandler
|
||||
from cpl_cli.command.help_service import HelpService
|
||||
from cpl_cli.command.version_service import VersionService
|
||||
from cpl_cli.error import Error
|
||||
from cpl_cli.publish.publisher import Publisher
|
||||
from cpl_cli.publish.publisher_service import Publisher
|
||||
from cpl_cli.publish.publisher_abc import PublisherABC
|
||||
|
||||
|
||||
@@ -66,11 +66,11 @@ class Startup(StartupABC):
|
||||
|
||||
self._services.add_transient(PublisherABC, Publisher)
|
||||
|
||||
self._services.add_transient(Build)
|
||||
self._services.add_transient(Generate)
|
||||
self._services.add_transient(Help)
|
||||
self._services.add_transient(New)
|
||||
self._services.add_transient(Publish)
|
||||
self._services.add_transient(Version)
|
||||
self._services.add_transient(BuildService)
|
||||
self._services.add_transient(GenerateService)
|
||||
self._services.add_transient(HelpService)
|
||||
self._services.add_transient(NewService)
|
||||
self._services.add_transient(PublishService)
|
||||
self._services.add_transient(VersionService)
|
||||
|
||||
return self._services
|
||||
|
Reference in New Issue
Block a user