orionis 0.504.0__py3-none-any.whl → 0.505.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.
@@ -400,10 +400,13 @@ class Reactor(IReactor):
400
400
 
401
401
  # Create an ArgumentParser instance to handle the command arguments
402
402
  arg_parser = argparse.ArgumentParser(
403
- description=f"{obj.signature} - {obj.description}",
404
- formatter_class=argparse.RawDescriptionHelpFormatter,
403
+ usage=f"python -B reactor {obj.signature} [options]",
404
+ description=f"Command [{obj.signature}] : {obj.description}",
405
+ formatter_class=argparse.RawTextHelpFormatter,
405
406
  add_help=True,
406
- allow_abbrev=False
407
+ allow_abbrev=False,
408
+ exit_on_error=True,
409
+ prog=obj.signature
407
410
  )
408
411
  for arg in required_args:
409
412
  arg.addToParser(arg_parser)
@@ -27,9 +27,11 @@ class CLIRequest(BaseEntity):
27
27
  """
28
28
 
29
29
  # The command to execute
30
- command: str
30
+ command: str = field(
31
+ default=None
32
+ )
31
33
 
32
34
  # Arguments for the command; defaults to an empty list if not provided
33
35
  args: list[str] = field(
34
- default_factory=list
36
+ default_factory=lambda: []
35
37
  )
orionis/console/kernel.py CHANGED
@@ -1,8 +1,8 @@
1
- import sys
2
1
  from typing import List
3
2
  from orionis.console.contracts.kernel import IKernelCLI
4
3
  from orionis.console.contracts.reactor import IReactor
5
4
  from orionis.console.entities.request import CLIRequest
5
+ from orionis.console.request.cli_request import Request
6
6
  from orionis.failure.contracts.catch import ICatch
7
7
  from orionis.foundation.contracts.application import IApplication
8
8
  from orionis.console.exceptions import CLIOrionisValueError
@@ -65,42 +65,20 @@ class KernelCLI(IKernelCLI):
65
65
  If invalid arguments are provided or no command is specified, this method may terminate the process with an error message.
66
66
  """
67
67
 
68
- try:
69
-
70
- # Ensure the arguments are provided as a list
71
- if not isinstance(args, list):
72
- raise CLIOrionisValueError(
73
- f"Failed to handle command line arguments: expected list, got {type(args).__module__}.{type(args).__name__}."
74
- )
75
-
76
- # If no arguments or only the script name is provided, show the default help command
77
- if not args or len(args) <= 1:
78
- return self.__reactor.call('help')
79
-
80
- # Remove the first argument (script name) to process only the command and its parameters
81
- args = args[1:]
68
+ request: CLIRequest = CLIRequest()
82
69
 
83
- # If no command is provided after removing the script name, exit with an error
84
- if len(args) == 0:
85
- raise CLIOrionisValueError("No command provided to execute.")
86
-
87
- # If only the command is provided, call it without additional arguments
88
- if len(args) == 1:
89
- return self.__reactor.call(args[0])
70
+ try:
90
71
 
91
- # Create a CLIRequest instance with the command and its arguments
92
- command = CLIRequest(
93
- command=args[0],
94
- args=args[1:]
95
- )
72
+ # create a CLIRequest instance by processing the provided arguments
73
+ request = Request(args)
96
74
 
97
75
  # If command and arguments are provided, call the command with its arguments
98
76
  return self.__reactor.call(
99
- command.command,
100
- command.args
77
+ request.command,
78
+ request.args
101
79
  )
102
80
 
103
81
  except BaseException as e:
104
82
 
105
83
  # Catch any exceptions that occur during command handling
106
- self.__catch.exception(self, args, e)
84
+ self.__catch.exception(self, request, e)
@@ -0,0 +1,45 @@
1
+ from typing import List
2
+ from orionis.console.entities.request import CLIRequest as CLIRequestEntity
3
+ from orionis.console.exceptions.cli_orionis_value_error import CLIOrionisValueError
4
+
5
+ class CLIRequest:
6
+ def __call__(self, args: List[str]) -> "CLIRequestEntity":
7
+ """
8
+ Processes command-line arguments and returns a CLIRequest instance.
9
+
10
+ Parameters
11
+ ----------
12
+ args : List[str]
13
+ The list of command-line arguments. The first argument is expected to be the script name.
14
+
15
+ Returns
16
+ -------
17
+ CLIRequestEntity
18
+ An instance representing the parsed command and its arguments.
19
+
20
+ Raises
21
+ ------
22
+ CLIOrionisValueError
23
+ If the provided arguments are not a list or if no command is provided.
24
+ """
25
+ if not isinstance(args, list):
26
+ raise CLIOrionisValueError(
27
+ f"Failed to handle command line arguments: expected list, got {type(args).__module__}.{type(args).__name__}."
28
+ )
29
+
30
+ if len(args) <= 1:
31
+ raise CLIOrionisValueError("No command provided to execute.")
32
+
33
+ # Remove the script name
34
+ args = args[1:]
35
+
36
+ if not args or not args[0]:
37
+ raise CLIOrionisValueError("No command provided to execute.")
38
+
39
+ return CLIRequestEntity(
40
+ command=args[0],
41
+ args=args[1:]
42
+ )
43
+
44
+ # Export the CLIRequest Singleton
45
+ Request = CLIRequest()
@@ -1,4 +1,5 @@
1
1
  from typing import Any, List
2
+ from orionis.console.entities.request import CLIRequest
2
3
  from orionis.console.output.contracts.console import IConsole
3
4
  from orionis.failure.contracts.handler import IBaseExceptionHandler
4
5
  from orionis.failure.entities.throwable import Throwable
@@ -91,7 +92,7 @@ class BaseExceptionHandler(IBaseExceptionHandler):
91
92
  # Return the structured exception
92
93
  return throwable
93
94
 
94
- def renderCLI(self, args: List[str], exception: BaseException, log: ILogger, console: IConsole) -> Any:
95
+ def renderCLI(self, request: CLIRequest, exception: BaseException, log: ILogger, console: IConsole) -> Any:
95
96
  """
96
97
  Render the exception message for CLI output.
97
98
 
@@ -111,8 +112,11 @@ class BaseExceptionHandler(IBaseExceptionHandler):
111
112
  # Convert the exception into a structured Throwable object
112
113
  throwable = self.destructureException(exception)
113
114
 
115
+ args = request.args if isinstance(request, CLIRequest) and request.args else []
116
+ string_args = ' '.join(args)
117
+
114
118
  # Log the CLI error message with arguments
115
- log.error(f"CLI Error: {throwable.message} (Args: {args})")
119
+ log.error(f"CLI Error: {throwable.message} (Args: {string_args})")
116
120
 
117
121
  # Output the exception traceback to the console
118
122
  console.newLine()
orionis/failure/catch.py CHANGED
@@ -86,7 +86,7 @@ class Catch(ICatch):
86
86
  # If a kernel is provided, render the exception details to the CLI
87
87
  if isinstance(kernel, KernelCLI):
88
88
  return self.__exception_handler.renderCLI(
89
- args=request,
89
+ request=request,
90
90
  exception=e,
91
91
  log=self.__logger,
92
92
  console=self.__console
@@ -1,5 +1,6 @@
1
1
  from abc import abstractmethod
2
- from typing import Any, List
2
+ from typing import Any
3
+ from orionis.console.entities.request import CLIRequest
3
4
  from orionis.console.output.contracts.console import IConsole
4
5
  from orionis.services.log.contracts.log_service import ILogger
5
6
 
@@ -61,7 +62,7 @@ class IBaseExceptionHandler:
61
62
  pass
62
63
 
63
64
  @abstractmethod
64
- def renderCLI(self, args: List[str], exception: BaseException, log: ILogger, console: IConsole) -> Any:
65
+ def renderCLI(self, request: CLIRequest, exception: BaseException, log: ILogger, console: IConsole) -> Any:
65
66
  """
66
67
  Render the exception message for CLI output.
67
68
 
@@ -5,7 +5,7 @@
5
5
  NAME = "orionis"
6
6
 
7
7
  # Current version of the framework
8
- VERSION = "0.504.0"
8
+ VERSION = "0.505.0"
9
9
 
10
10
  # Full name of the author or maintainer of the project
11
11
  AUTHOR = "Raul Mauricio Uñate Castro"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: orionis
3
- Version: 0.504.0
3
+ Version: 0.505.0
4
4
  Summary: Orionis Framework – Elegant, Fast, and Powerful.
5
5
  Home-page: https://github.com/orionis-framework/framework
6
6
  Author: Raul Mauricio Uñate Castro
@@ -1,7 +1,7 @@
1
1
  orionis/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
2
  orionis/app.py,sha256=b69fOzj2J8Aw5g0IldWZXixUDeeTO9vcHc_Njses9HU,603
3
3
  orionis/console/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
4
- orionis/console/kernel.py,sha256=KPFKnz5zkWytB0-UNdsV9t_1m2tyA6TLc4mDA2q8v5o,4042
4
+ orionis/console/kernel.py,sha256=m4RoulZB3nkl6-O250UDN4ZoXqfTF4F5gbAYt7TAnQo,3054
5
5
  orionis/console/args/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
6
6
  orionis/console/args/argument.py,sha256=Is8Z8_kW4DvcK1nK1UU-sa6Pk0BeOdcRczCayW0ZVHc,20360
7
7
  orionis/console/args/enums/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -28,7 +28,7 @@ orionis/console/contracts/listener.py,sha256=tXp2kTVEaqLRWZC6BY8xqj3JP0xpDDx4btP
28
28
  orionis/console/contracts/reactor.py,sha256=Xeq7Zrw6WE5MV_XOQfiQEchAFbb6-0TjLpjWOxYW--g,4554
29
29
  orionis/console/contracts/schedule.py,sha256=eGjcOH7kgdf0fWDZRfOFUQsIx4E8G38ayX5JwpkpN8E,4977
30
30
  orionis/console/core/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
31
- orionis/console/core/reactor.py,sha256=FMf64avmcuC1JtdjC8LLrgPuhp_Nau9Q_LcLl6JJ6DM,30278
31
+ orionis/console/core/reactor.py,sha256=3i7-jn_HBwYfsNR8xpExt5Owi3nk9BfHnW7J7lUmb-4,30414
32
32
  orionis/console/dumper/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
33
33
  orionis/console/dumper/dump.py,sha256=CATERiQ6XuIrKQsDaWcVxzTtlAJI9qLJX44fQxEX8ws,22443
34
34
  orionis/console/dumper/contracts/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -39,7 +39,7 @@ orionis/console/dynamic/contracts/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeR
39
39
  orionis/console/dynamic/contracts/progress_bar.py,sha256=NYebL2h-vg2t2H6IhJjuC37gglRkpT-MW71wbJtpLNg,1784
40
40
  orionis/console/entities/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
41
41
  orionis/console/entities/listeners.py,sha256=I5JbbnwKz-ZQhQgS2r1wqfUTwagg8Os6qzfEY8FzVzg,5345
42
- orionis/console/entities/request.py,sha256=5FikL80Ks99Ut4AlfKpyXIKVMZQUtYqvfCFn80lPZdc,936
42
+ orionis/console/entities/request.py,sha256=Sm-6jMd95teUEdh_4VJWjsDbvfID3khHCOU_2OEEIv4,980
43
43
  orionis/console/enums/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
44
44
  orionis/console/enums/command.py,sha256=lCfVp2vnDojJN2gjdVxE_XU3mRjZZgOIxPfBVQYo9w4,1278
45
45
  orionis/console/enums/event.py,sha256=XRV7N14N5HHt-c0HqYhrbKv4n2P7ZOCcBT_3OAQzenU,1929
@@ -56,6 +56,7 @@ orionis/console/output/contracts/console.py,sha256=phaQhCLWa81MLzB5ydOSaUfEIdDq7
56
56
  orionis/console/output/contracts/executor.py,sha256=7l3kwnvv6GlH9EYk0v94YE1olex_-mvgyRDAqZvvYrQ,4254
57
57
  orionis/console/output/enums/__init__.py,sha256=LAaAxg-DpArCjf_jqZ0_9s3p8899gntDYkSU_ppTdC8,66
58
58
  orionis/console/output/enums/styles.py,sha256=6a4oQCOBOKMh2ARdeq5GlIskJ3wjiylYmh66tUKKmpQ,4053
59
+ orionis/console/request/cli_request.py,sha256=7-sgYmNUCipuHLVAwWLJiHv0cJCDmsM1Lu9s2D8RIII,1498
59
60
  orionis/console/tasks/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
60
61
  orionis/console/tasks/event.py,sha256=NcSmq3y4JWviXaSvRifmJs0nWqQQgHIDmzlWELrLeNU,12204
61
62
  orionis/console/tasks/exception_report.py,sha256=IN1PCQ08ZHs1sivUpzi2f9U9eW8ydZyb8GO6KiT56LY,3643
@@ -93,12 +94,12 @@ orionis/container/validators/is_subclass.py,sha256=4sBaGLoRs8nUhuWjlP0VJqyTwVHYq
93
94
  orionis/container/validators/is_valid_alias.py,sha256=4uAYcq8xov7jZbXnpKpjNkxcZtlTNnL5RRctVPMwJes,1424
94
95
  orionis/container/validators/lifetime.py,sha256=IQ43fDNrxYHMlZH2zlYDJnlkLO_eS4U7Fs3UJgQBidI,1844
95
96
  orionis/failure/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
96
- orionis/failure/catch.py,sha256=LCr2Fy7mMwhAILx9VVb0KUZTRPg7UyE_8Ai_hJP0NMQ,3627
97
+ orionis/failure/catch.py,sha256=qob2sM-VmYo5C6rY21UdBEAIpJo0bwpjRW1hQjbrOnI,3630
97
98
  orionis/failure/base/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
98
- orionis/failure/base/handler.py,sha256=vA4u9UqKzzRXIafLTxi3beeCxPGco_0BMhazASahNqs,4464
99
+ orionis/failure/base/handler.py,sha256=L6jB2_2f8ZKBuys8o_iXTwMM_yjQHY7iXNF1Q3X8BGY,4661
99
100
  orionis/failure/contracts/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
100
101
  orionis/failure/contracts/catch.py,sha256=e2wM1p6VxbvAjgWm-MwoM9p2ystSsyBu8Qnt6Ehr6Vc,1179
101
- orionis/failure/contracts/handler.py,sha256=1WyFx7D9h5chNnOXDQhg6o-RqNfhTHblm_xWzCDu4SM,2161
102
+ orionis/failure/contracts/handler.py,sha256=4N9yMkMgdhtHbRGAyCtuTx3GmkPP74vhqdRLmwl-ckQ,2216
102
103
  orionis/failure/entities/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
103
104
  orionis/failure/entities/throwable.py,sha256=ogys062uhim5QMYU62ezlnumRAnYQlUf_vZvQY47S3U,1227
104
105
  orionis/foundation/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -218,7 +219,7 @@ orionis/foundation/providers/scheduler_provider.py,sha256=72SoixFog9IOE9Ve9Xcfw6
218
219
  orionis/foundation/providers/testing_provider.py,sha256=SrJRpdvcblx9WvX7x9Y3zc7OQfiTf7la0HAJrm2ESlE,3725
219
220
  orionis/foundation/providers/workers_provider.py,sha256=oa_2NIDH6UxZrtuGkkoo_zEoNIMGgJ46vg5CCgAm7wI,3926
220
221
  orionis/metadata/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
221
- orionis/metadata/framework.py,sha256=AYMbt2P-GM7ooLNwbP6C8foJqalDU8Fe9MK2UqIr8PA,4109
222
+ orionis/metadata/framework.py,sha256=kzHxiSxC1o-lxs1vOuDC4drt88JpIaCgTGUcNrNqiPs,4109
222
223
  orionis/metadata/package.py,sha256=k7Yriyp5aUcR-iR8SK2ec_lf0_Cyc-C7JczgXa-I67w,16039
223
224
  orionis/services/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
224
225
  orionis/services/asynchrony/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -394,8 +395,7 @@ orionis/test/validators/web_report.py,sha256=n9BfzOZz6aEiNTypXcwuWbFRG0OdHNSmCNu
394
395
  orionis/test/validators/workers.py,sha256=rWcdRexINNEmGaO7mnc1MKUxkHKxrTsVuHgbnIfJYgc,1206
395
396
  orionis/test/view/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
396
397
  orionis/test/view/render.py,sha256=f-zNhtKSg9R5Njqujbg2l2amAs2-mRVESneLIkWOZjU,4082
397
- orionis-0.504.0.dist-info/licenses/LICENCE,sha256=JhC-z_9mbpUrCfPjcl3DhDA8trNDMzb57cvRSam1avc,1463
398
- tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
398
+ orionis-0.505.0.dist-info/licenses/LICENCE,sha256=JhC-z_9mbpUrCfPjcl3DhDA8trNDMzb57cvRSam1avc,1463
399
399
  tests/container/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
400
400
  tests/container/context/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
401
401
  tests/container/context/test_manager.py,sha256=wOwXpl9rHNfTTexa9GBKYMwK0_-KSQPbI-AEyGNkmAE,1356
@@ -541,8 +541,8 @@ tests/testing/validators/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZ
541
541
  tests/testing/validators/test_testing_validators.py,sha256=WPo5GxTP6xE-Dw3X1vZoqOMpb6HhokjNSbgDsDRDvy4,16588
542
542
  tests/testing/view/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
543
543
  tests/testing/view/test_render.py,sha256=tnnMBwS0iKUIbogLvu-7Rii50G6Koddp3XT4wgdFEYM,1050
544
- orionis-0.504.0.dist-info/METADATA,sha256=ZM434O0Rv0eXh9QC4jQvPXabW2jM6BwmZmOGUrgSJE0,4801
545
- orionis-0.504.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
546
- orionis-0.504.0.dist-info/top_level.txt,sha256=2bdoHgyGZhOtLAXS6Om8OCTmL24dUMC_L1quMe_ETbk,14
547
- orionis-0.504.0.dist-info/zip-safe,sha256=frcCV1k9oG9oKj3dpUqdJg1PxRT2RSN_XKdLCPjaYaY,2
548
- orionis-0.504.0.dist-info/RECORD,,
544
+ orionis-0.505.0.dist-info/METADATA,sha256=MqayyZx1WKcTz0VN1_shUY09IPXfVWT5juaChVqNY3o,4801
545
+ orionis-0.505.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
546
+ orionis-0.505.0.dist-info/top_level.txt,sha256=2bdoHgyGZhOtLAXS6Om8OCTmL24dUMC_L1quMe_ETbk,14
547
+ orionis-0.505.0.dist-info/zip-safe,sha256=frcCV1k9oG9oKj3dpUqdJg1PxRT2RSN_XKdLCPjaYaY,2
548
+ orionis-0.505.0.dist-info/RECORD,,
tests/__init__.py DELETED
File without changes