2021.4 #19
@ -1,4 +1,4 @@
|
|||||||
from cpl.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.publish.publisher_abc import PublisherABC
|
from cpl_cli.publish.publisher_abc import PublisherABC
|
||||||
|
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
from cpl.console.console import Console
|
from cpl.console.console import Console
|
||||||
|
from cpl.console.foreground_color import ForegroundColor
|
||||||
from cpl_cli.command_abc import CommandABC
|
from cpl_cli.command_abc import CommandABC
|
||||||
|
|
||||||
|
|
||||||
@ -20,9 +21,9 @@ class Help(CommandABC):
|
|||||||
['version (v|V)', 'Outputs CPL CLI version.']
|
['version (v|V)', 'Outputs CPL CLI version.']
|
||||||
]
|
]
|
||||||
for name, description in commands:
|
for name, description in commands:
|
||||||
Console.set_foreground_color('blue')
|
Console.set_foreground_color(ForegroundColor.blue)
|
||||||
Console.write(f'\n\t{name} ')
|
Console.write(f'\n\t{name} ')
|
||||||
Console.set_foreground_color('default')
|
Console.set_foreground_color(ForegroundColor.default)
|
||||||
Console.write(f'{description}')
|
Console.write(f'{description}')
|
||||||
|
|
||||||
Console.write('\n')
|
Console.write('\n')
|
||||||
|
@ -97,7 +97,6 @@ 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
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
from cpl.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.publish.publisher_abc import PublisherABC
|
from cpl_cli.publish.publisher_abc import PublisherABC
|
||||||
|
|
||||||
|
@ -7,6 +7,7 @@ import pkg_resources
|
|||||||
import cpl
|
import cpl
|
||||||
import cpl_cli
|
import cpl_cli
|
||||||
from cpl.console.console import Console
|
from cpl.console.console import Console
|
||||||
|
from cpl.console.foreground_color import ForegroundColor
|
||||||
from cpl_cli.command_abc import CommandABC
|
from cpl_cli.command_abc import CommandABC
|
||||||
|
|
||||||
|
|
||||||
@ -16,16 +17,25 @@ class Version(CommandABC):
|
|||||||
CommandABC.__init__(self)
|
CommandABC.__init__(self)
|
||||||
|
|
||||||
def run(self, args: list[str]):
|
def run(self, args: list[str]):
|
||||||
Console.set_foreground_color('yellow')
|
Console.set_foreground_color(ForegroundColor.yellow)
|
||||||
Console.banner('CPL CLI')
|
Console.banner('CPL CLI')
|
||||||
Console.set_foreground_color('default')
|
Console.set_foreground_color('default')
|
||||||
if '__version__' in dir(cpl_cli):
|
if '__version__' in dir(cpl_cli):
|
||||||
Console.write_line(f'Common Python Library CLI: {cpl_cli.__version__}')
|
Console.set_foreground_color(ForegroundColor.yellow)
|
||||||
|
Console.write_line(f'Common Python Library CLI: ')
|
||||||
|
Console.set_foreground_color(ForegroundColor.default)
|
||||||
|
Console.write(cpl_cli.__version__)
|
||||||
|
|
||||||
|
Console.set_foreground_color(ForegroundColor.blue)
|
||||||
|
Console.write_line(f'Python: ')
|
||||||
|
Console.set_foreground_color(ForegroundColor.default)
|
||||||
|
Console.write(f'{sys.version_info.major}.{sys.version_info.minor}.{sys.version_info.micro}')
|
||||||
|
|
||||||
Console.write_line(f'Python: {sys.version_info.major}.{sys.version_info.minor}.{sys.version_info.micro}')
|
|
||||||
Console.write_line(f'OS: {platform.system()} {platform.processor()}')
|
Console.write_line(f'OS: {platform.system()} {platform.processor()}')
|
||||||
|
|
||||||
Console.write_line('CPL:')
|
Console.set_foreground_color(ForegroundColor.yellow)
|
||||||
|
Console.write_line('\nCPL packages:')
|
||||||
|
Console.set_foreground_color(ForegroundColor.default)
|
||||||
packages = []
|
packages = []
|
||||||
for importer, modname, is_pkg in pkgutil.iter_modules(cpl.__path__):
|
for importer, modname, is_pkg in pkgutil.iter_modules(cpl.__path__):
|
||||||
module = importer.find_module(modname).load_module(modname)
|
module = importer.find_module(modname).load_module(modname)
|
||||||
@ -34,7 +44,9 @@ class Version(CommandABC):
|
|||||||
|
|
||||||
Console.table(['Name', 'Version'], packages)
|
Console.table(['Name', 'Version'], packages)
|
||||||
|
|
||||||
Console.write_line('\nPython Packages:')
|
Console.set_foreground_color(ForegroundColor.blue)
|
||||||
|
Console.write_line('\nPython packages:')
|
||||||
|
Console.set_foreground_color(ForegroundColor.default)
|
||||||
packages = []
|
packages = []
|
||||||
dependencies = dict(tuple(str(ws).split()) for ws in pkg_resources.working_set)
|
dependencies = dict(tuple(str(ws).split()) for ws in pkg_resources.working_set)
|
||||||
for p in dependencies:
|
for p in dependencies:
|
||||||
|
@ -7,6 +7,7 @@ import setuptools
|
|||||||
from setuptools import sandbox
|
from setuptools import sandbox
|
||||||
|
|
||||||
from cpl.application.application_runtime_abc import ApplicationRuntimeABC
|
from cpl.application.application_runtime_abc import ApplicationRuntimeABC
|
||||||
|
from cpl.console.foreground_color import ForegroundColor
|
||||||
from cpl.console.console import Console
|
from cpl.console.console import Console
|
||||||
from cpl_cli.configuration.build_settings import BuildSettings
|
from cpl_cli.configuration.build_settings import BuildSettings
|
||||||
from cpl_cli.configuration.project_settings import ProjectSettings
|
from cpl_cli.configuration.project_settings import ProjectSettings
|
||||||
@ -298,20 +299,20 @@ class Publisher(PublisherABC):
|
|||||||
def build(self):
|
def build(self):
|
||||||
self._output_path = os.path.join(self._output_path, 'build')
|
self._output_path = os.path.join(self._output_path, 'build')
|
||||||
|
|
||||||
Console.spinner('Reading source files:', self._read_sources)
|
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)
|
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)
|
Console.spinner('Building application:', self._dist_files, text_foreground_color=ForegroundColor.green, spinner_foreground_color=ForegroundColor.blue)
|
||||||
|
|
||||||
def publish(self):
|
def publish(self):
|
||||||
self._output_path = os.path.join(self._output_path, 'publish')
|
self._output_path = os.path.join(self._output_path, 'publish')
|
||||||
|
|
||||||
Console.write_line('Build:')
|
Console.write_line('Build:')
|
||||||
Console.spinner('Reading source files:', self._read_sources)
|
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)
|
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)
|
Console.spinner('Building application:', self._dist_files, text_foreground_color=ForegroundColor.green, spinner_foreground_color=ForegroundColor.blue)
|
||||||
|
|
||||||
Console.write_line('\nPublish:')
|
Console.write_line('\nPublish:')
|
||||||
Console.spinner('Generating setup_template.py:', self._create_setup)
|
Console.spinner('Generating setup_template.py:', self._create_setup, text_foreground_color=ForegroundColor.green, spinner_foreground_color=ForegroundColor.blue)
|
||||||
Console.write_line('Running setup_template.py:\n')
|
Console.write_line('Running setup_template.py:\n')
|
||||||
self._run_setup()
|
self._run_setup()
|
||||||
# Console.spinner('Cleaning dist path:', self._clean_dist_files)
|
# Console.spinner('Cleaning dist path:', self._clean_dist_files)
|
||||||
|
Loading…
Reference in New Issue
Block a user