orionis 0.448.0__py3-none-any.whl → 0.449.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- orionis/console/args/argument.py +174 -43
- orionis/console/args/parser.py +37 -3
- orionis/console/base/command.py +103 -48
- orionis/console/base/contracts/command.py +97 -40
- orionis/console/core/reactor.py +408 -14
- orionis/console/output/contracts/executor.py +93 -0
- orionis/console/output/executor.py +153 -0
- orionis/foundation/application.py +6 -2
- orionis/foundation/providers/console_provider.py +35 -10
- orionis/foundation/providers/dumper_provider.py +42 -14
- orionis/foundation/providers/executor_provider.py +80 -0
- orionis/foundation/providers/inspirational_provider.py +43 -23
- orionis/foundation/providers/logger_provider.py +47 -8
- orionis/foundation/providers/progress_bar_provider.py +55 -10
- orionis/foundation/providers/testing_provider.py +75 -31
- orionis/foundation/providers/workers_provider.py +69 -11
- orionis/metadata/framework.py +1 -1
- orionis/support/facades/console.py +11 -3
- orionis/support/facades/dumper.py +10 -3
- orionis/support/facades/executor.py +24 -0
- orionis/support/facades/inspire.py +9 -6
- orionis/support/facades/logger.py +11 -4
- orionis/support/facades/progress_bar.py +9 -3
- orionis/support/facades/testing.py +10 -4
- orionis/support/facades/workers.py +8 -4
- orionis/test/kernel.py +2 -2
- {orionis-0.448.0.dist-info → orionis-0.449.0.dist-info}/METADATA +1 -1
- {orionis-0.448.0.dist-info → orionis-0.449.0.dist-info}/RECORD +32 -28
- {orionis-0.448.0.dist-info → orionis-0.449.0.dist-info}/WHEEL +0 -0
- {orionis-0.448.0.dist-info → orionis-0.449.0.dist-info}/licenses/LICENCE +0 -0
- {orionis-0.448.0.dist-info → orionis-0.449.0.dist-info}/top_level.txt +0 -0
- {orionis-0.448.0.dist-info → orionis-0.449.0.dist-info}/zip-safe +0 -0
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
from abc import ABC, abstractmethod
|
|
2
|
+
|
|
3
|
+
class IExecutor(ABC):
|
|
4
|
+
|
|
5
|
+
@abstractmethod
|
|
6
|
+
def running(self, program: str, time: str = ''):
|
|
7
|
+
"""
|
|
8
|
+
Logs the execution of a program in a "RUNNING" state with console output formatting.
|
|
9
|
+
|
|
10
|
+
This method outputs a formatted console message indicating that a program or process
|
|
11
|
+
is currently running. It uses ANSI color coding to highlight the running state with
|
|
12
|
+
a warning color (typically yellow/orange) to draw attention to active processes.
|
|
13
|
+
The output includes timestamp, program name, optional execution time, and colored
|
|
14
|
+
state indicator in a structured format.
|
|
15
|
+
|
|
16
|
+
Parameters
|
|
17
|
+
----------
|
|
18
|
+
program : str
|
|
19
|
+
The name of the program or process that is currently being executed.
|
|
20
|
+
This will be displayed in the console output to identify which process
|
|
21
|
+
is in the running state.
|
|
22
|
+
time : str, optional
|
|
23
|
+
The current execution time duration with appropriate units (e.g., '30s', '2m 15s').
|
|
24
|
+
If not provided, defaults to an empty string and no time information will be
|
|
25
|
+
displayed in the output. Default is ''.
|
|
26
|
+
|
|
27
|
+
Returns
|
|
28
|
+
-------
|
|
29
|
+
None
|
|
30
|
+
This method does not return any value. It prints the formatted running state
|
|
31
|
+
message directly to the console output via the private __ansiOutput method.
|
|
32
|
+
"""
|
|
33
|
+
pass
|
|
34
|
+
|
|
35
|
+
@abstractmethod
|
|
36
|
+
def done(self, program: str, time: str = ''):
|
|
37
|
+
"""
|
|
38
|
+
Logs the execution of a program in a "DONE" state with console output formatting.
|
|
39
|
+
|
|
40
|
+
This method outputs a formatted console message indicating that a program or process
|
|
41
|
+
has completed successfully. It uses ANSI color coding to highlight the completion state
|
|
42
|
+
with a success color (typically green) to indicate successful execution. The output
|
|
43
|
+
includes timestamp, program name, optional execution time, and colored state indicator
|
|
44
|
+
in a structured format consistent with other execution state methods.
|
|
45
|
+
|
|
46
|
+
Parameters
|
|
47
|
+
----------
|
|
48
|
+
program : str
|
|
49
|
+
The name of the program or process that has completed execution.
|
|
50
|
+
This will be displayed in the console output to identify which process
|
|
51
|
+
has finished successfully.
|
|
52
|
+
time : str, optional
|
|
53
|
+
The total execution time duration with appropriate units (e.g., '30s', '2m 15s').
|
|
54
|
+
If not provided, defaults to an empty string and no time information will be
|
|
55
|
+
displayed in the output. Default is ''.
|
|
56
|
+
|
|
57
|
+
Returns
|
|
58
|
+
-------
|
|
59
|
+
None
|
|
60
|
+
This method does not return any value. It prints the formatted completion state
|
|
61
|
+
message directly to the console output via the private __ansiOutput method.
|
|
62
|
+
"""
|
|
63
|
+
pass
|
|
64
|
+
|
|
65
|
+
@abstractmethod
|
|
66
|
+
def fail(self, program: str, time: str = ''):
|
|
67
|
+
"""
|
|
68
|
+
Logs the execution of a program in a "FAIL" state with console output formatting.
|
|
69
|
+
|
|
70
|
+
This method outputs a formatted console message indicating that a program or process
|
|
71
|
+
has failed during execution. It uses ANSI color coding to highlight the failure state
|
|
72
|
+
with an error color (typically red) to clearly indicate unsuccessful execution. The output
|
|
73
|
+
includes timestamp, program name, optional execution time, and colored state indicator
|
|
74
|
+
in a structured format consistent with other execution state methods.
|
|
75
|
+
|
|
76
|
+
Parameters
|
|
77
|
+
----------
|
|
78
|
+
program : str
|
|
79
|
+
The name of the program or process that has failed during execution.
|
|
80
|
+
This will be displayed in the console output to identify which process
|
|
81
|
+
encountered an error or failure.
|
|
82
|
+
time : str, optional
|
|
83
|
+
The execution time duration before failure with appropriate units (e.g., '30s', '2m 15s').
|
|
84
|
+
If not provided, defaults to an empty string and no time information will be
|
|
85
|
+
displayed in the output. Default is ''.
|
|
86
|
+
|
|
87
|
+
Returns
|
|
88
|
+
-------
|
|
89
|
+
None
|
|
90
|
+
This method does not return any value. It prints the formatted failure state
|
|
91
|
+
message directly to the console output via the private __ansiOutput method.
|
|
92
|
+
"""
|
|
93
|
+
pass
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
from datetime import datetime
|
|
2
|
+
from orionis.console.output.contracts.executor import IExecutor
|
|
3
|
+
from orionis.console.output.enums.styles import ANSIColors
|
|
4
|
+
|
|
5
|
+
class Executor(IExecutor):
|
|
6
|
+
|
|
7
|
+
def __ansiOutput(self, program: str, state: str, state_color: str, time: str = ''):
|
|
8
|
+
"""
|
|
9
|
+
Outputs a formatted console message with timestamp, program name, and execution state using ANSI colors.
|
|
10
|
+
|
|
11
|
+
This private method creates a structured log line that displays execution information
|
|
12
|
+
in a consistent format. The output includes a timestamp, program name, dotted line
|
|
13
|
+
separator, optional execution time, and colored state indicator.
|
|
14
|
+
|
|
15
|
+
Parameters
|
|
16
|
+
----------
|
|
17
|
+
program : str
|
|
18
|
+
The name of the program or process being executed.
|
|
19
|
+
state : str
|
|
20
|
+
The current execution state (e.g., 'RUNNING', 'DONE', 'FAIL').
|
|
21
|
+
state_color : str
|
|
22
|
+
The ANSI color code used to colorize the state text.
|
|
23
|
+
time : str, optional
|
|
24
|
+
The execution time duration with units (e.g., '30s', '2m 15s').
|
|
25
|
+
Default is an empty string if no time information is available.
|
|
26
|
+
|
|
27
|
+
Returns
|
|
28
|
+
-------
|
|
29
|
+
None
|
|
30
|
+
This method does not return any value. It prints the formatted message
|
|
31
|
+
directly to the console output.
|
|
32
|
+
"""
|
|
33
|
+
# Define the total width for the formatted output line
|
|
34
|
+
width = 60
|
|
35
|
+
|
|
36
|
+
# Calculate the length of state and time strings for spacing calculations
|
|
37
|
+
len_state = len(state)
|
|
38
|
+
len_time = len(time)
|
|
39
|
+
|
|
40
|
+
# Create a dotted line that fills the remaining space between program name and state/time
|
|
41
|
+
line = '.' * (width - (len(program) + len_state + len_time))
|
|
42
|
+
|
|
43
|
+
# Format the timestamp with muted color and current date/time
|
|
44
|
+
timestamp = f"{ANSIColors.TEXT_MUTED.value}{datetime.now().strftime('%Y-%m-%d %H:%M:%S')}{ANSIColors.DEFAULT.value}"
|
|
45
|
+
|
|
46
|
+
# Keep program name without additional formatting
|
|
47
|
+
program_formatted = f"{program}"
|
|
48
|
+
|
|
49
|
+
# Format time with muted color if provided, otherwise use empty string
|
|
50
|
+
time_formatted = f"{ANSIColors.TEXT_MUTED.value}{time}{ANSIColors.DEFAULT.value}" if time else ""
|
|
51
|
+
|
|
52
|
+
# Format state with the specified color and reset to default
|
|
53
|
+
state_formatted = f"{state_color}{state}{ANSIColors.DEFAULT.value}"
|
|
54
|
+
|
|
55
|
+
# Add line breaks for RUNNING state at start, for other states at end
|
|
56
|
+
start = "\n\r" if state == 'RUNNING' else ''
|
|
57
|
+
end = "\n\r" if state != 'RUNNING' else ''
|
|
58
|
+
|
|
59
|
+
# Print the complete formatted message to console
|
|
60
|
+
print(f"{start}{timestamp} | {program_formatted} {line} {time_formatted} {state_formatted}{end}")
|
|
61
|
+
|
|
62
|
+
def running(self, program: str, time: str = ''):
|
|
63
|
+
"""
|
|
64
|
+
Logs the execution of a program in a "RUNNING" state with console output formatting.
|
|
65
|
+
|
|
66
|
+
This method outputs a formatted console message indicating that a program or process
|
|
67
|
+
is currently running. It uses ANSI color coding to highlight the running state with
|
|
68
|
+
a warning color (typically yellow/orange) to draw attention to active processes.
|
|
69
|
+
The output includes timestamp, program name, optional execution time, and colored
|
|
70
|
+
state indicator in a structured format.
|
|
71
|
+
|
|
72
|
+
Parameters
|
|
73
|
+
----------
|
|
74
|
+
program : str
|
|
75
|
+
The name of the program or process that is currently being executed.
|
|
76
|
+
This will be displayed in the console output to identify which process
|
|
77
|
+
is in the running state.
|
|
78
|
+
time : str, optional
|
|
79
|
+
The current execution time duration with appropriate units (e.g., '30s', '2m 15s').
|
|
80
|
+
If not provided, defaults to an empty string and no time information will be
|
|
81
|
+
displayed in the output. Default is ''.
|
|
82
|
+
|
|
83
|
+
Returns
|
|
84
|
+
-------
|
|
85
|
+
None
|
|
86
|
+
This method does not return any value. It prints the formatted running state
|
|
87
|
+
message directly to the console output via the private __ansiOutput method.
|
|
88
|
+
"""
|
|
89
|
+
|
|
90
|
+
# Call the private ANSI output method with RUNNING state and warning color formatting
|
|
91
|
+
self.__ansiOutput(program, "RUNNING", ANSIColors.TEXT_BOLD_WARNING.value, time)
|
|
92
|
+
|
|
93
|
+
def done(self, program: str, time: str = ''):
|
|
94
|
+
"""
|
|
95
|
+
Logs the execution of a program in a "DONE" state with console output formatting.
|
|
96
|
+
|
|
97
|
+
This method outputs a formatted console message indicating that a program or process
|
|
98
|
+
has completed successfully. It uses ANSI color coding to highlight the completion state
|
|
99
|
+
with a success color (typically green) to indicate successful execution. The output
|
|
100
|
+
includes timestamp, program name, optional execution time, and colored state indicator
|
|
101
|
+
in a structured format consistent with other execution state methods.
|
|
102
|
+
|
|
103
|
+
Parameters
|
|
104
|
+
----------
|
|
105
|
+
program : str
|
|
106
|
+
The name of the program or process that has completed execution.
|
|
107
|
+
This will be displayed in the console output to identify which process
|
|
108
|
+
has finished successfully.
|
|
109
|
+
time : str, optional
|
|
110
|
+
The total execution time duration with appropriate units (e.g., '30s', '2m 15s').
|
|
111
|
+
If not provided, defaults to an empty string and no time information will be
|
|
112
|
+
displayed in the output. Default is ''.
|
|
113
|
+
|
|
114
|
+
Returns
|
|
115
|
+
-------
|
|
116
|
+
None
|
|
117
|
+
This method does not return any value. It prints the formatted completion state
|
|
118
|
+
message directly to the console output via the private __ansiOutput method.
|
|
119
|
+
"""
|
|
120
|
+
|
|
121
|
+
# Call the private ANSI output method with DONE state and success color formatting
|
|
122
|
+
self.__ansiOutput(program, "DONE", ANSIColors.TEXT_BOLD_SUCCESS.value, time)
|
|
123
|
+
|
|
124
|
+
def fail(self, program: str, time: str = ''):
|
|
125
|
+
"""
|
|
126
|
+
Logs the execution of a program in a "FAIL" state with console output formatting.
|
|
127
|
+
|
|
128
|
+
This method outputs a formatted console message indicating that a program or process
|
|
129
|
+
has failed during execution. It uses ANSI color coding to highlight the failure state
|
|
130
|
+
with an error color (typically red) to clearly indicate unsuccessful execution. The output
|
|
131
|
+
includes timestamp, program name, optional execution time, and colored state indicator
|
|
132
|
+
in a structured format consistent with other execution state methods.
|
|
133
|
+
|
|
134
|
+
Parameters
|
|
135
|
+
----------
|
|
136
|
+
program : str
|
|
137
|
+
The name of the program or process that has failed during execution.
|
|
138
|
+
This will be displayed in the console output to identify which process
|
|
139
|
+
encountered an error or failure.
|
|
140
|
+
time : str, optional
|
|
141
|
+
The execution time duration before failure with appropriate units (e.g., '30s', '2m 15s').
|
|
142
|
+
If not provided, defaults to an empty string and no time information will be
|
|
143
|
+
displayed in the output. Default is ''.
|
|
144
|
+
|
|
145
|
+
Returns
|
|
146
|
+
-------
|
|
147
|
+
None
|
|
148
|
+
This method does not return any value. It prints the formatted failure state
|
|
149
|
+
message directly to the console output via the private __ansiOutput method.
|
|
150
|
+
"""
|
|
151
|
+
|
|
152
|
+
# Call the private ANSI output method with FAIL state and error color formatting
|
|
153
|
+
self.__ansiOutput(program, "FAIL", ANSIColors.TEXT_BOLD_ERROR.value, time)
|
|
@@ -177,6 +177,8 @@ class Application(Container, IApplication):
|
|
|
177
177
|
from orionis.foundation.providers.progress_bar_provider import ProgressBarProvider
|
|
178
178
|
from orionis.foundation.providers.workers_provider import WorkersProvider
|
|
179
179
|
from orionis.foundation.providers.testing_provider import TestingProvider
|
|
180
|
+
from orionis.foundation.providers.inspirational_provider import InspirationalProvider
|
|
181
|
+
from orionis.foundation.providers.executor_provider import ConsoleExecuteProvider
|
|
180
182
|
|
|
181
183
|
# Core framework providers
|
|
182
184
|
core_providers = [
|
|
@@ -185,7 +187,9 @@ class Application(Container, IApplication):
|
|
|
185
187
|
ProgressBarProvider,
|
|
186
188
|
WorkersProvider,
|
|
187
189
|
LoggerProvider,
|
|
188
|
-
TestingProvider
|
|
190
|
+
TestingProvider,
|
|
191
|
+
InspirationalProvider,
|
|
192
|
+
ConsoleExecuteProvider
|
|
189
193
|
]
|
|
190
194
|
|
|
191
195
|
# Register each core provider
|
|
@@ -1927,7 +1931,7 @@ class Application(Container, IApplication):
|
|
|
1927
1931
|
self.__loadFrameworksKernel()
|
|
1928
1932
|
|
|
1929
1933
|
# Retrieve logger and console instances from the container
|
|
1930
|
-
logger: ILoggerService = self.make('
|
|
1934
|
+
logger: ILoggerService = self.make('x-orionis.services.log.log_service')
|
|
1931
1935
|
|
|
1932
1936
|
# Calculate elapsed time in milliseconds since application start
|
|
1933
1937
|
elapsed_ms = (time.time_ns() - self.startAt) // 1_000_000
|
|
@@ -4,37 +4,62 @@ from orionis.container.providers.service_provider import ServiceProvider
|
|
|
4
4
|
|
|
5
5
|
class ConsoleProvider(ServiceProvider):
|
|
6
6
|
"""
|
|
7
|
-
|
|
7
|
+
Console output service provider for the Orionis framework.
|
|
8
8
|
|
|
9
|
-
This provider
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
This service provider is responsible for registering and configuring the console
|
|
10
|
+
output service within the application's dependency injection container. It binds
|
|
11
|
+
the IConsole interface to its concrete Console implementation, enabling the
|
|
12
|
+
application to access comprehensive console output functionality including
|
|
13
|
+
informational messages, warnings, errors, debug output, tabular data display,
|
|
14
|
+
user confirmations, and secure password input prompts.
|
|
15
|
+
|
|
16
|
+
The provider follows the standard service provider pattern, implementing both
|
|
17
|
+
registration and boot phases for proper initialization within the application
|
|
18
|
+
lifecycle.
|
|
12
19
|
"""
|
|
13
20
|
|
|
14
21
|
def register(self) -> None:
|
|
15
22
|
"""
|
|
16
|
-
Register the console output service in the application container.
|
|
23
|
+
Register the console output service in the application's dependency injection container.
|
|
24
|
+
|
|
25
|
+
This method binds the IConsole interface to its concrete Console implementation,
|
|
26
|
+
making console output functionality available throughout the application. The
|
|
27
|
+
service is registered as a transient dependency, meaning a new instance will
|
|
28
|
+
be created each time it is requested from the container.
|
|
17
29
|
|
|
18
|
-
|
|
19
|
-
|
|
30
|
+
The registration uses a predefined alias to ensure consistent service
|
|
31
|
+
identification across the framework and facilitate easy service resolution.
|
|
20
32
|
|
|
21
33
|
Returns
|
|
22
34
|
-------
|
|
23
35
|
None
|
|
36
|
+
This method does not return any value. It performs side effects by
|
|
37
|
+
modifying the application's service container.
|
|
24
38
|
"""
|
|
25
39
|
|
|
26
|
-
self.app.transient(IConsole, Console, alias="
|
|
40
|
+
self.app.transient(IConsole, Console, alias="x-orionis.console.output.console")
|
|
27
41
|
|
|
28
42
|
def boot(self) -> None:
|
|
29
43
|
"""
|
|
30
44
|
Perform post-registration initialization for the console provider.
|
|
31
45
|
|
|
32
|
-
This method is
|
|
33
|
-
|
|
46
|
+
This method is called after the registration phase is complete and all services
|
|
47
|
+
have been registered in the container. It provides an opportunity to perform
|
|
48
|
+
any additional setup, configuration, or initialization that depends on other
|
|
49
|
+
services being available in the container.
|
|
50
|
+
|
|
51
|
+
Currently, this implementation serves as a placeholder and does not perform
|
|
52
|
+
any specific initialization tasks. The console service is fully functional
|
|
53
|
+
after registration and does not require additional boot-time configuration.
|
|
54
|
+
|
|
55
|
+
This method is part of the service provider lifecycle and is automatically
|
|
56
|
+
invoked by the framework during application startup.
|
|
34
57
|
|
|
35
58
|
Returns
|
|
36
59
|
-------
|
|
37
60
|
None
|
|
61
|
+
This method does not return any value and is called for its side effects
|
|
62
|
+
during the service provider boot phase.
|
|
38
63
|
"""
|
|
39
64
|
|
|
40
65
|
pass
|
|
@@ -4,48 +4,76 @@ from orionis.container.providers.service_provider import ServiceProvider
|
|
|
4
4
|
|
|
5
5
|
class DumperProvider(ServiceProvider):
|
|
6
6
|
"""
|
|
7
|
-
Service provider for registering the
|
|
7
|
+
Service provider for registering debug and dumper services in the application container.
|
|
8
8
|
|
|
9
|
-
This provider
|
|
10
|
-
|
|
9
|
+
This provider is responsible for binding debug-related interfaces to their concrete
|
|
10
|
+
implementations within the application's dependency injection container. It enables
|
|
11
|
+
comprehensive debug message printing, error reporting, console diagnostics, and
|
|
12
|
+
data dumping functionality throughout the application.
|
|
13
|
+
|
|
14
|
+
The provider follows the service provider pattern, ensuring that debug services
|
|
15
|
+
are properly registered and available for dependency injection across all
|
|
16
|
+
application components that require debugging capabilities.
|
|
11
17
|
|
|
12
18
|
Attributes
|
|
13
19
|
----------
|
|
14
20
|
app : Application
|
|
15
|
-
The application container instance
|
|
21
|
+
The application container instance used for service registration and
|
|
22
|
+
dependency injection management.
|
|
16
23
|
|
|
17
24
|
Methods
|
|
18
25
|
-------
|
|
19
|
-
register()
|
|
20
|
-
Register the debug service in the application container.
|
|
21
|
-
boot()
|
|
22
|
-
Perform post-registration initialization
|
|
26
|
+
register() -> None
|
|
27
|
+
Register the debug service interface binding in the application container.
|
|
28
|
+
boot() -> None
|
|
29
|
+
Perform any post-registration initialization tasks for the dumper services.
|
|
30
|
+
|
|
31
|
+
Notes
|
|
32
|
+
-----
|
|
33
|
+
This provider registers services as transient, meaning new instances are created
|
|
34
|
+
for each resolution request, ensuring isolated debugging contexts.
|
|
23
35
|
"""
|
|
24
36
|
|
|
25
37
|
def register(self) -> None:
|
|
26
38
|
"""
|
|
27
39
|
Register the debug service in the application container.
|
|
28
40
|
|
|
29
|
-
|
|
30
|
-
|
|
41
|
+
This method binds the IDebug interface to its concrete implementation (Debug class)
|
|
42
|
+
in the application's dependency injection container. The service is registered as
|
|
43
|
+
transient, meaning a new instance will be created each time it is requested.
|
|
44
|
+
The service is also assigned an alias for easy retrieval throughout the application.
|
|
45
|
+
|
|
46
|
+
The registration enables the application to resolve debug-related dependencies
|
|
47
|
+
and provides access to debugging, error reporting, and console diagnostic
|
|
48
|
+
functionality via the registered alias.
|
|
31
49
|
|
|
32
50
|
Returns
|
|
33
51
|
-------
|
|
34
52
|
None
|
|
53
|
+
This method does not return any value. It performs side effects by
|
|
54
|
+
modifying the application container's service registry.
|
|
35
55
|
"""
|
|
36
56
|
|
|
37
|
-
self.app.transient(IDebug, Debug, alias="
|
|
57
|
+
self.app.transient(IDebug, Debug, alias="x-orionis.console.dumper.dump")
|
|
38
58
|
|
|
39
59
|
def boot(self) -> None:
|
|
40
60
|
"""
|
|
41
|
-
Perform post-registration initialization
|
|
61
|
+
Perform post-registration initialization for the dumper service provider.
|
|
62
|
+
|
|
63
|
+
This method is called after all service providers have been registered
|
|
64
|
+
in the application container. It provides an opportunity to perform
|
|
65
|
+
additional setup, configuration, or initialization logic that depends
|
|
66
|
+
on other services being available in the container.
|
|
42
67
|
|
|
43
|
-
|
|
44
|
-
|
|
68
|
+
Currently, this method contains no implementation as the dumper service
|
|
69
|
+
does not require any post-registration initialization. The debug service
|
|
70
|
+
registration is sufficient and complete during the register() phase.
|
|
45
71
|
|
|
46
72
|
Returns
|
|
47
73
|
-------
|
|
48
74
|
None
|
|
75
|
+
This method does not return any value and performs no operations
|
|
76
|
+
in the current implementation.
|
|
49
77
|
"""
|
|
50
78
|
|
|
51
79
|
pass
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
from orionis.console.output.contracts.executor import IExecutor
|
|
2
|
+
from orionis.console.output.executor import Executor
|
|
3
|
+
from orionis.container.providers.service_provider import ServiceProvider
|
|
4
|
+
|
|
5
|
+
class ConsoleExecuteProvider(ServiceProvider):
|
|
6
|
+
"""
|
|
7
|
+
Console executor service provider for dependency injection container registration.
|
|
8
|
+
|
|
9
|
+
This service provider is responsible for registering and configuring console executor
|
|
10
|
+
services within the application's dependency injection container. It binds the
|
|
11
|
+
IExecutor interface to its concrete Executor implementation, enabling standardized
|
|
12
|
+
console operations throughout the application including command execution, output
|
|
13
|
+
formatting, and process management.
|
|
14
|
+
|
|
15
|
+
The provider follows the standard service provider lifecycle pattern, implementing
|
|
16
|
+
both registration and boot phases to ensure proper service initialization and
|
|
17
|
+
configuration within the application container.
|
|
18
|
+
|
|
19
|
+
Attributes
|
|
20
|
+
----------
|
|
21
|
+
app : Container
|
|
22
|
+
The application's dependency injection container instance used for service
|
|
23
|
+
registration and binding management.
|
|
24
|
+
|
|
25
|
+
Methods
|
|
26
|
+
-------
|
|
27
|
+
register() -> None
|
|
28
|
+
Registers the console executor service binding in the container.
|
|
29
|
+
boot() -> None
|
|
30
|
+
Performs post-registration initialization and configuration tasks.
|
|
31
|
+
|
|
32
|
+
Notes
|
|
33
|
+
-----
|
|
34
|
+
This provider registers services as transient bindings to ensure isolated
|
|
35
|
+
execution contexts for each console operation request.
|
|
36
|
+
"""
|
|
37
|
+
|
|
38
|
+
def register(self) -> None:
|
|
39
|
+
"""
|
|
40
|
+
Register the console executor service in the application container.
|
|
41
|
+
|
|
42
|
+
This method binds the IExecutor interface to its concrete Executor implementation
|
|
43
|
+
as a transient service. The transient binding ensures that a new instance of
|
|
44
|
+
the Executor is created each time it is requested from the container, providing
|
|
45
|
+
isolated execution contexts for console operations.
|
|
46
|
+
|
|
47
|
+
The service is registered with the alias "x-orionis.console.output.executor" to
|
|
48
|
+
enable easy retrieval and identification within the dependency injection container.
|
|
49
|
+
|
|
50
|
+
Returns
|
|
51
|
+
-------
|
|
52
|
+
None
|
|
53
|
+
This method does not return any value. It performs the side effect of
|
|
54
|
+
registering the executor service binding in the application container.
|
|
55
|
+
"""
|
|
56
|
+
|
|
57
|
+
self.app.transient(IExecutor, Executor, alias="x-orionis.console.output.executor")
|
|
58
|
+
|
|
59
|
+
def boot(self) -> None:
|
|
60
|
+
"""
|
|
61
|
+
Perform post-registration initialization for the console executor provider.
|
|
62
|
+
|
|
63
|
+
This method is called after the service registration phase and provides
|
|
64
|
+
an opportunity to perform additional setup, configuration, or initialization
|
|
65
|
+
tasks that depend on the registered services. It follows the service provider
|
|
66
|
+
lifecycle pattern where registration occurs first, followed by booting.
|
|
67
|
+
|
|
68
|
+
Currently, this implementation serves as a placeholder and does not perform
|
|
69
|
+
any specific initialization tasks. Subclasses or future implementations may
|
|
70
|
+
override this method to add custom boot logic such as service validation,
|
|
71
|
+
configuration setup, or dependent service initialization.
|
|
72
|
+
|
|
73
|
+
Returns
|
|
74
|
+
-------
|
|
75
|
+
None
|
|
76
|
+
This method does not return any value. It performs initialization
|
|
77
|
+
side effects only.
|
|
78
|
+
"""
|
|
79
|
+
|
|
80
|
+
pass
|
|
@@ -4,22 +4,29 @@ from orionis.services.inspirational.inspire import Inspire
|
|
|
4
4
|
|
|
5
5
|
class InspirationalProvider(ServiceProvider):
|
|
6
6
|
"""
|
|
7
|
-
|
|
7
|
+
Service provider for registering inspirational services in the application container.
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
9
|
+
The InspirationalProvider handles the registration and configuration of inspirational
|
|
10
|
+
services within the application's dependency injection container. This provider follows
|
|
11
|
+
the service provider pattern, ensuring that inspirational service implementations are
|
|
12
|
+
properly bound to their corresponding contracts and made available for dependency
|
|
13
|
+
injection throughout the application lifecycle.
|
|
14
|
+
|
|
15
|
+
The provider manages the binding of the IInspire contract to its concrete Inspire
|
|
16
|
+
implementation, configuring it as a transient service to ensure fresh instances
|
|
17
|
+
are created for each resolution request.
|
|
13
18
|
|
|
14
19
|
Attributes
|
|
15
20
|
----------
|
|
16
21
|
app : Application
|
|
17
|
-
The application container instance
|
|
22
|
+
The application container instance used for service registration and dependency
|
|
23
|
+
injection management.
|
|
18
24
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
25
|
+
Notes
|
|
26
|
+
-----
|
|
27
|
+
This provider inherits from ServiceProvider and implements the standard service
|
|
28
|
+
provider lifecycle methods (register and boot) to properly integrate inspirational
|
|
29
|
+
services into the application's service container architecture.
|
|
23
30
|
"""
|
|
24
31
|
|
|
25
32
|
def register(self) -> None:
|
|
@@ -27,35 +34,48 @@ class InspirationalProvider(ServiceProvider):
|
|
|
27
34
|
Registers the inspirational service in the application container.
|
|
28
35
|
|
|
29
36
|
This method binds the `IInspire` contract to its concrete implementation `Inspire`
|
|
30
|
-
as a transient service within the application's service container.
|
|
31
|
-
|
|
32
|
-
resolution
|
|
37
|
+
as a transient service within the application's service container. Transient
|
|
38
|
+
services are created each time they are requested from the container, ensuring
|
|
39
|
+
fresh instances for each resolution. The service is also registered with an
|
|
40
|
+
alias to enable convenient resolution and identification throughout the application.
|
|
33
41
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
42
|
+
The registration establishes the dependency injection mapping that allows other
|
|
43
|
+
parts of the application to receive the inspirational service implementation
|
|
44
|
+
when requesting the `IInspire` interface.
|
|
37
45
|
|
|
38
46
|
Returns
|
|
39
47
|
-------
|
|
40
48
|
None
|
|
41
|
-
This method
|
|
49
|
+
This method performs service registration as a side effect and does not
|
|
50
|
+
return any value.
|
|
42
51
|
"""
|
|
43
52
|
|
|
44
|
-
self.app.transient(IInspire, Inspire, alias="
|
|
53
|
+
self.app.transient(IInspire, Inspire, alias="x-orionis.services.inspirational.inspire")
|
|
45
54
|
|
|
46
55
|
def boot(self) -> None:
|
|
47
56
|
"""
|
|
48
57
|
Executes post-registration initialization for the inspirational service.
|
|
49
58
|
|
|
50
|
-
This method is
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
59
|
+
This method is called after all services have been registered in the
|
|
60
|
+
application container and provides an opportunity to perform any additional
|
|
61
|
+
setup, configuration, or initialization logic specific to the inspirational
|
|
62
|
+
service. It follows the service provider lifecycle pattern where registration
|
|
63
|
+
happens first, followed by booting for final setup tasks.
|
|
64
|
+
|
|
65
|
+
The boot phase is particularly useful for operations that depend on other
|
|
66
|
+
services being available in the container, cross-service configuration,
|
|
67
|
+
or initialization of resources that require the complete service graph
|
|
68
|
+
to be established.
|
|
69
|
+
|
|
70
|
+
By default, this implementation performs no operations, but subclasses
|
|
71
|
+
can override this method to implement custom initialization logic as
|
|
72
|
+
required by specific use cases.
|
|
54
73
|
|
|
55
74
|
Returns
|
|
56
75
|
-------
|
|
57
76
|
None
|
|
58
|
-
This method does not return any value. It
|
|
77
|
+
This method does not return any value. It performs initialization
|
|
78
|
+
operations as side effects only.
|
|
59
79
|
"""
|
|
60
80
|
|
|
61
81
|
pass
|