Smaller bugfixes
This commit is contained in:
parent
8872d1bfe7
commit
2c2c1ede21
@ -22,9 +22,13 @@
|
|||||||
<select />
|
<select />
|
||||||
</component>
|
</component>
|
||||||
<component name="ChangeListManager">
|
<component name="ChangeListManager">
|
||||||
<list default="true" id="7e2256bc-a6b8-4880-83a6-8b0e3372d0a4" name="Default Changelist" comment="Improved help command">
|
<list default="true" id="7e2256bc-a6b8-4880-83a6-8b0e3372d0a4" name="Default Changelist" comment="Improved cli">
|
||||||
|
<change afterPath="$PROJECT_DIR$/src/cpl_cli/error.py" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/src/cpl/application/application_abc.py" beforeDir="false" afterPath="$PROJECT_DIR$/src/cpl/application/application_abc.py" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/src/cpl/application/application_host.py" beforeDir="false" afterPath="$PROJECT_DIR$/src/cpl/application/application_host.py" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/src/cpl_cli/cli.py" beforeDir="false" afterPath="$PROJECT_DIR$/src/cpl_cli/cli.py" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/src/cpl_cli/cli.py" beforeDir="false" afterPath="$PROJECT_DIR$/src/cpl_cli/cli.py" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/src/cpl_cli/command_handler.py" beforeDir="false" afterPath="$PROJECT_DIR$/src/cpl_cli/command_handler.py" afterDir="false" />
|
||||||
</list>
|
</list>
|
||||||
<option name="SHOW_DIALOG" value="false" />
|
<option name="SHOW_DIALOG" value="false" />
|
||||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||||
@ -89,14 +93,14 @@
|
|||||||
<recent name="$PROJECT_DIR$/src/cpl/common/application" />
|
<recent name="$PROJECT_DIR$/src/cpl/common/application" />
|
||||||
</key>
|
</key>
|
||||||
<key name="MoveFile.RECENT_KEYS">
|
<key name="MoveFile.RECENT_KEYS">
|
||||||
|
<recent name="$PROJECT_DIR$/src/cpl_cli" />
|
||||||
<recent name="$PROJECT_DIR$/src/cpl" />
|
<recent name="$PROJECT_DIR$/src/cpl" />
|
||||||
<recent name="$PROJECT_DIR$/src/cpl/database/connection" />
|
<recent name="$PROJECT_DIR$/src/cpl/database/connection" />
|
||||||
<recent name="$PROJECT_DIR$/src/cpl/database/context" />
|
<recent name="$PROJECT_DIR$/src/cpl/database/context" />
|
||||||
<recent name="$PROJECT_DIR$/src/cpl/database" />
|
<recent name="$PROJECT_DIR$/src/cpl/database" />
|
||||||
<recent name="$PROJECT_DIR$/src/cpl/common/application" />
|
|
||||||
</key>
|
</key>
|
||||||
</component>
|
</component>
|
||||||
<component name="RunManager" selected="Python.cli version">
|
<component name="RunManager" selected="Python.cli help">
|
||||||
<configuration name="cli build" type="PythonConfigurationType" factoryName="Python">
|
<configuration name="cli build" type="PythonConfigurationType" factoryName="Python">
|
||||||
<module name="sh_common_py_lib" />
|
<module name="sh_common_py_lib" />
|
||||||
<option name="INTERPRETER_OPTIONS" value="" />
|
<option name="INTERPRETER_OPTIONS" value="" />
|
||||||
@ -485,13 +489,6 @@
|
|||||||
<option name="presentableId" value="Default" />
|
<option name="presentableId" value="Default" />
|
||||||
<updated>1605881914521</updated>
|
<updated>1605881914521</updated>
|
||||||
</task>
|
</task>
|
||||||
<task id="LOCAL-00039" summary="Improved ApplicationHost">
|
|
||||||
<created>1608047655667</created>
|
|
||||||
<option name="number" value="00039" />
|
|
||||||
<option name="presentableId" value="LOCAL-00039" />
|
|
||||||
<option name="project" value="LOCAL" />
|
|
||||||
<updated>1608047655667</updated>
|
|
||||||
</task>
|
|
||||||
<task id="LOCAL-00040" summary="Improved publisher">
|
<task id="LOCAL-00040" summary="Improved publisher">
|
||||||
<created>1608048544558</created>
|
<created>1608048544558</created>
|
||||||
<option name="number" value="00040" />
|
<option name="number" value="00040" />
|
||||||
@ -828,7 +825,14 @@
|
|||||||
<option name="project" value="LOCAL" />
|
<option name="project" value="LOCAL" />
|
||||||
<updated>1614797275948</updated>
|
<updated>1614797275948</updated>
|
||||||
</task>
|
</task>
|
||||||
<option name="localTasksCounter" value="88" />
|
<task id="LOCAL-00088" summary="Improved cli">
|
||||||
|
<created>1614797335732</created>
|
||||||
|
<option name="number" value="00088" />
|
||||||
|
<option name="presentableId" value="LOCAL-00088" />
|
||||||
|
<option name="project" value="LOCAL" />
|
||||||
|
<updated>1614797335732</updated>
|
||||||
|
</task>
|
||||||
|
<option name="localTasksCounter" value="89" />
|
||||||
<servers />
|
<servers />
|
||||||
</component>
|
</component>
|
||||||
<component name="Vcs.Log.Tabs.Properties">
|
<component name="Vcs.Log.Tabs.Properties">
|
||||||
@ -844,7 +848,6 @@
|
|||||||
<option name="oldMeFiltersMigrated" value="true" />
|
<option name="oldMeFiltersMigrated" value="true" />
|
||||||
</component>
|
</component>
|
||||||
<component name="VcsManagerConfiguration">
|
<component name="VcsManagerConfiguration">
|
||||||
<MESSAGE value="Improved error handling" />
|
|
||||||
<MESSAGE value="Improved service providing" />
|
<MESSAGE value="Improved service providing" />
|
||||||
<MESSAGE value="Added email client" />
|
<MESSAGE value="Added email client" />
|
||||||
<MESSAGE value="Published" />
|
<MESSAGE value="Published" />
|
||||||
@ -869,7 +872,8 @@
|
|||||||
<MESSAGE value="Improved application" />
|
<MESSAGE value="Improved application" />
|
||||||
<MESSAGE value="Added version and help cli command" />
|
<MESSAGE value="Added version and help cli command" />
|
||||||
<MESSAGE value="Improved help command" />
|
<MESSAGE value="Improved help command" />
|
||||||
<option name="LAST_COMMIT_MESSAGE" value="Improved help command" />
|
<MESSAGE value="Improved cli" />
|
||||||
|
<option name="LAST_COMMIT_MESSAGE" value="Improved cli" />
|
||||||
</component>
|
</component>
|
||||||
<component name="XDebuggerManager">
|
<component name="XDebuggerManager">
|
||||||
<breakpoint-manager>
|
<breakpoint-manager>
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
import atexit
|
||||||
from abc import ABC, abstractmethod
|
from abc import ABC, abstractmethod
|
||||||
from typing import Type, Optional
|
from typing import Type, Optional
|
||||||
|
|
||||||
@ -20,6 +21,10 @@ class ApplicationABC(ABC):
|
|||||||
def use_startup(self, startup: Type[StartupABC]):
|
def use_startup(self, startup: Type[StartupABC]):
|
||||||
self._startup = startup()
|
self._startup = startup()
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def output_at_exit():
|
||||||
|
atexit.register(Console.close)
|
||||||
|
|
||||||
def build(self):
|
def build(self):
|
||||||
if self._startup is not None:
|
if self._startup is not None:
|
||||||
self._app_host = self._startup.create_application_host()
|
self._app_host = self._startup.create_application_host()
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
import atexit
|
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
|
|
||||||
from cpl.application.application_host_abc import ApplicationHostABC
|
from cpl.application.application_host_abc import ApplicationHostABC
|
||||||
@ -6,7 +5,6 @@ from cpl.application.application_runtime import ApplicationRuntime
|
|||||||
from cpl.application.application_runtime_abc import ApplicationRuntimeABC
|
from cpl.application.application_runtime_abc import ApplicationRuntimeABC
|
||||||
from cpl.configuration.configuration import Configuration
|
from cpl.configuration.configuration import Configuration
|
||||||
from cpl.configuration.configuration_abc import ConfigurationABC
|
from cpl.configuration.configuration_abc import ConfigurationABC
|
||||||
from cpl.console.console import Console
|
|
||||||
from cpl.dependency_injection.service_provider import ServiceProvider
|
from cpl.dependency_injection.service_provider import ServiceProvider
|
||||||
from cpl.dependency_injection.service_provider_base import ServiceProviderABC
|
from cpl.dependency_injection.service_provider_base import ServiceProviderABC
|
||||||
|
|
||||||
@ -25,8 +23,6 @@ class ApplicationHost(ApplicationHostABC):
|
|||||||
self._start_time: datetime = datetime.now()
|
self._start_time: datetime = datetime.now()
|
||||||
self._end_time: datetime = datetime.now()
|
self._end_time: datetime = datetime.now()
|
||||||
|
|
||||||
atexit.register(Console.close)
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def configuration(self) -> ConfigurationABC:
|
def configuration(self) -> ConfigurationABC:
|
||||||
return self._config
|
return self._config
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
from typing import Optional
|
from typing import Optional
|
||||||
|
|
||||||
from cpl.application.application_abc import ApplicationABC
|
from cpl.application.application_abc import ApplicationABC
|
||||||
from cpl.console.console import Console
|
|
||||||
from cpl_cli.command import Command
|
from cpl_cli.command import Command
|
||||||
from cpl_cli.command_handler import CommandHandler
|
from cpl_cli.command_handler import CommandHandler
|
||||||
|
from cpl_cli.error import Error
|
||||||
from cpl_cli.commands.help import Help
|
from cpl_cli.commands.help import Help
|
||||||
from cpl_cli.commands.version import Version
|
from cpl_cli.commands.version import Version
|
||||||
|
|
||||||
@ -23,8 +23,7 @@ class CLI(ApplicationABC):
|
|||||||
|
|
||||||
def main(self):
|
def main(self):
|
||||||
if len(self._configuration.additional_arguments) < 1:
|
if len(self._configuration.additional_arguments) < 1:
|
||||||
Console.error(f'Expected command')
|
Error.error(f'Expected command')
|
||||||
Console.error('Run \'cpl help\'')
|
|
||||||
return
|
return
|
||||||
|
|
||||||
self._command_handler.handle(self._configuration.additional_arguments[0], self._configuration.additional_arguments[1:])
|
self._command_handler.handle(self._configuration.additional_arguments[0], self._configuration.additional_arguments[1:])
|
||||||
|
@ -18,5 +18,4 @@ class CommandHandler(ServiceABC):
|
|||||||
def handle(self, cmd: str, args: list[str]):
|
def handle(self, cmd: str, args: list[str]):
|
||||||
for command in self._commands:
|
for command in self._commands:
|
||||||
if cmd == command.name or cmd in command.aliases:
|
if cmd == command.name or cmd in command.aliases:
|
||||||
print(command.command)
|
|
||||||
command.command.run(args)
|
command.command.run(args)
|
||||||
|
9
src/cpl_cli/error.py
Normal file
9
src/cpl_cli/error.py
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
from cpl.console.console import Console
|
||||||
|
|
||||||
|
|
||||||
|
class Error:
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def error(message: str):
|
||||||
|
Console.error(message)
|
||||||
|
Console.error('Run \'cpl help\'')
|
Loading…
Reference in New Issue
Block a user