cpl@2022.6.13 - cpl run command #78

Merged
edraft merged 1 commits from 2022.6.13 into 2022.6 2022-05-25 08:42:42 +02:00
6 changed files with 62 additions and 6 deletions
Showing only changes of commit 477d2d87d3 - Show all commits

View File

@ -0,0 +1,53 @@
import os
import textwrap
from cpl_cli.command_abc import CommandABC
from cpl_core.console.console import Console
from cpl_core.environment.application_environment_abc import ApplicationEnvironmentABC
from cpl_cli.configuration.build_settings import BuildSettings
from cpl_cli.configuration.project_settings import ProjectSettings
from cpl_cli.live_server.live_server_thread import LiveServerThread
class RunService(CommandABC):
def __init__(self, env: ApplicationEnvironmentABC, project_settings: ProjectSettings, build_settings: BuildSettings):
"""
Service for the CLI command start
:param env:
:param project_settings:
:param build_settings:
"""
CommandABC.__init__(self)
self._env = env
self._project_settings = project_settings
self._build_settings = build_settings
self._src_dir = os.path.join(self._env.working_directory, self._build_settings.source_path)
self._args: list[str] = []
@property
def help_message(self) -> str:
return textwrap.dedent("""\
Starts your application.
Usage: cpl run
""")
def execute(self, args: list[str]):
"""
Entry point of command
:param args:
:return:
"""
ls_thread = LiveServerThread(
self._project_settings.python_executable,
self._src_dir,
self._args,
self._env,
self._build_settings
)
ls_thread.start()
ls_thread.join()
Console.write_line()

View File

@ -4,7 +4,7 @@
"Version": {
"Major": "2022",
"Minor": "6",
"Micro": "1.dev4"
"Micro": "13"
},
"Author": "Sven Heidemann",
"AuthorEmail": "sven.heidemann@sh-edraft.de",
@ -16,7 +16,7 @@
"LicenseName": "MIT",
"LicenseDescription": "MIT, see LICENSE for more details.",
"Dependencies": [
"cpl-core>=2022.6.1.dev4"
"cpl-core>=2022.6.13"
],
"PythonVersion": ">=3.10",
"PythonPath": {},

View File

@ -10,6 +10,7 @@ from cpl_cli.command.install_service import InstallService
from cpl_cli.command.new_service import NewService
from cpl_cli.command.publish_service import PublishService
from cpl_cli.command.remove_service import RemoveService
from cpl_cli.command.run_service import RunService
from cpl_cli.command.start_service import StartService
from cpl_cli.command.uninstall_service import UninstallService
from cpl_cli.command.update_service import UpdateService
@ -84,6 +85,7 @@ class StartupArgumentExtension(StartupExtensionABC):
config.create_console_argument(ArgumentTypeEnum.Executable, '', 'publish', ['p', 'P'], PublishService, True, validators=[ProjectValidator])
config.create_console_argument(ArgumentTypeEnum.Executable, '', 'remove', ['r', 'R'], RemoveService, True, validators=[WorkspaceValidator]) \
.add_console_argument(ArgumentTypeEnum.Flag, '--', 'simulate', ['s', 'S'])
config.create_console_argument(ArgumentTypeEnum.Executable, '', 'run', [], RunService, True, validators=[ProjectValidator])
config.create_console_argument(ArgumentTypeEnum.Executable, '', 'start', ['s', 'S'], StartService, True, validators=[ProjectValidator])
config.create_console_argument(ArgumentTypeEnum.Executable, '', 'uninstall', ['ui', 'UI'], UninstallService, True, validators=[ProjectValidator]) \
.add_console_argument(ArgumentTypeEnum.Flag, '--', 'virtual', ['v', 'V']) \
@ -110,6 +112,7 @@ class StartupArgumentExtension(StartupExtensionABC):
services.add_transient(NewService)
services.add_transient(PublishService)
services.add_transient(RemoveService)
services.add_transient(RunService)
services.add_transient(StartService)
services.add_transient(UninstallService)
services.add_transient(UpdateService)

View File

@ -339,7 +339,7 @@ class Configuration(ConfigurationABC):
prevent = exe.prevent_next_executable
success = True
except Exception as e:
Console.error('An error occurred while executing arguments.', traceback.format_exc())
Console.error('An error occurred while executing arguments.')
sys.exit()
return success

View File

@ -4,7 +4,7 @@
"Version": {
"Major": "2022",
"Minor": "6",
"Micro": "1.dev4"
"Micro": "13"
},
"Author": "Sven Heidemann",
"AuthorEmail": "sven.heidemann@sh-edraft.de",

View File

@ -4,7 +4,7 @@
"Version": {
"Major": "2022",
"Minor": "6",
"Micro": "1.dev4"
"Micro": "13"
},
"Author": "Sven Heidemann",
"AuthorEmail": "sven.heidemann@sh-edraft.de",
@ -16,7 +16,7 @@
"LicenseName": "MIT",
"LicenseDescription": "MIT, see LICENSE for more details.",
"Dependencies": [
"cpl-core>=2022.6.1.dev4"
"cpl-core>=2022.6.13"
],
"PythonVersion": ">=3.10",
"PythonPath": {},