Added install package command

This commit is contained in:
2021-03-13 22:53:28 +01:00
parent a169c31ed5
commit 6094b11068
15 changed files with 234 additions and 90 deletions

View File

@@ -3,6 +3,7 @@ from typing import Optional
from cpl.application.application_abc import ApplicationABC
from cpl_cli.command.build_service import BuildService
from cpl_cli.command.generate_service import GenerateService
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.start_service import StartService
@@ -27,6 +28,7 @@ class CLI(ApplicationABC):
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('install', ['i', 'I'], InstallService, 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('start', ['s', 'S'], StartService, True))
@@ -34,8 +36,21 @@ class CLI(ApplicationABC):
self._command_handler.add_command(CommandModel('version', ['v', 'V'], VersionService, False))
def main(self):
if len(self._configuration.additional_arguments) < 1:
command = None
args = []
if len(self._configuration.additional_arguments) > 0:
command = self._configuration.additional_arguments[0]
if len(self._configuration.additional_arguments) > 1:
args = self._configuration.additional_arguments[1:]
else:
for cmd in self._command_handler.commands:
result = self._configuration.get_configuration(cmd.name)
if result is not None:
command = cmd.name
args.append(result)
if command is None:
Error.error(f'Expected command')
return
self._command_handler.handle(self._configuration.additional_arguments[0], self._configuration.additional_arguments[1:])
self._command_handler.handle(command, args)