orionis 0.539.0__py3-none-any.whl → 0.540.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/base/command.py +1 -1
- orionis/console/base/scheduler.py +1 -1
- orionis/console/contracts/base_command.py +123 -0
- orionis/console/contracts/cli_request.py +85 -0
- orionis/console/contracts/command.py +90 -108
- orionis/console/contracts/event.py +1 -1
- orionis/console/contracts/reactor.py +40 -0
- orionis/console/core/reactor.py +325 -91
- orionis/console/dumper/dump.py +1 -1
- orionis/console/dynamic/progress_bar.py +1 -1
- orionis/console/{enums → entities}/command.py +3 -0
- orionis/console/{enums → entities}/event.py +1 -1
- orionis/console/fluent/command.py +216 -0
- orionis/console/{tasks → fluent}/event.py +1 -1
- orionis/console/kernel.py +28 -11
- orionis/console/output/console.py +1 -1
- orionis/console/output/executor.py +1 -1
- orionis/console/request/cli_request.py +113 -31
- orionis/console/tasks/schedule.py +4 -4
- orionis/container/container.py +102 -1
- orionis/container/contracts/container.py +46 -0
- orionis/failure/base/handler.py +6 -6
- orionis/failure/catch.py +1 -1
- orionis/failure/contracts/handler.py +3 -3
- orionis/foundation/application.py +1 -1
- orionis/foundation/providers/console_provider.py +1 -1
- orionis/foundation/providers/dumper_provider.py +1 -1
- orionis/foundation/providers/executor_provider.py +1 -1
- orionis/foundation/providers/progress_bar_provider.py +1 -1
- orionis/metadata/framework.py +1 -1
- orionis/support/facades/application.pyi +5 -0
- orionis/support/facades/console.pyi +4 -0
- orionis/support/facades/directory.py +0 -1
- orionis/support/facades/directory.pyi +4 -0
- orionis/support/facades/dumper.pyi +4 -0
- orionis/support/facades/executor.pyi +4 -0
- orionis/support/facades/inspire.pyi +4 -0
- orionis/support/facades/logger.pyi +4 -0
- orionis/support/facades/performance_counter.pyi +4 -0
- orionis/support/facades/progress_bar.pyi +4 -0
- orionis/support/facades/reactor.pyi +97 -0
- orionis/support/facades/testing.pyi +4 -0
- orionis/test/kernel.py +1 -1
- {orionis-0.539.0.dist-info → orionis-0.540.0.dist-info}/METADATA +1 -1
- {orionis-0.539.0.dist-info → orionis-0.540.0.dist-info}/RECORD +56 -44
- orionis/console/entities/request.py +0 -37
- orionis/console/output/contracts/__init__.py +0 -0
- /orionis/console/contracts/{scheduler.py → base_scheduler.py} +0 -0
- /orionis/console/{output/contracts → contracts}/console.py +0 -0
- /orionis/console/{dumper/contracts → contracts}/dump.py +0 -0
- /orionis/console/{output/contracts → contracts}/executor.py +0 -0
- /orionis/console/{dynamic/contracts → contracts}/progress_bar.py +0 -0
- /orionis/console/{dumper/contracts → fluent}/__init__.py +0 -0
- /orionis/console/{dynamic/contracts → request}/__init__.py +0 -0
- {orionis-0.539.0.dist-info → orionis-0.540.0.dist-info}/WHEEL +0 -0
- {orionis-0.539.0.dist-info → orionis-0.540.0.dist-info}/licenses/LICENCE +0 -0
- {orionis-0.539.0.dist-info → orionis-0.540.0.dist-info}/top_level.txt +0 -0
- {orionis-0.539.0.dist-info → orionis-0.540.0.dist-info}/zip-safe +0 -0
orionis/console/base/command.py
CHANGED
|
@@ -2,7 +2,7 @@ from typing import Any, Dict, List
|
|
|
2
2
|
from orionis.console.args.argument import CLIArgument
|
|
3
3
|
from orionis.console.dynamic.progress_bar import ProgressBar
|
|
4
4
|
from orionis.console.output.console import Console
|
|
5
|
-
from orionis.console.contracts.
|
|
5
|
+
from orionis.console.contracts.base_command import IBaseCommand
|
|
6
6
|
|
|
7
7
|
class BaseCommand(Console, ProgressBar, IBaseCommand):
|
|
8
8
|
"""
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
from datetime import datetime
|
|
2
|
-
from orionis.console.contracts.
|
|
2
|
+
from orionis.console.contracts.base_scheduler import IBaseScheduler
|
|
3
3
|
from orionis.console.contracts.schedule import ISchedule
|
|
4
4
|
from orionis.console.entities.job_error import JobError
|
|
5
5
|
from orionis.console.entities.scheduler_paused import SchedulerPaused
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
from abc import ABC, abstractmethod
|
|
2
|
+
from typing import Any, Dict, List
|
|
3
|
+
from orionis.console.args.argument import CLIArgument
|
|
4
|
+
|
|
5
|
+
class IBaseCommand(ABC):
|
|
6
|
+
"""
|
|
7
|
+
Abstract base contract for console commands in Orionis framework.
|
|
8
|
+
|
|
9
|
+
This abstract base class defines the standardized interface that all console
|
|
10
|
+
commands must implement within the Orionis framework. It provides a consistent
|
|
11
|
+
contract for command execution, argument handling, metadata storage, and console
|
|
12
|
+
output management.
|
|
13
|
+
|
|
14
|
+
The class establishes the foundation for command-line interface functionality,
|
|
15
|
+
ensuring all commands follow a uniform pattern for registration, execution,
|
|
16
|
+
and user interaction while maintaining flexibility for specific command logic
|
|
17
|
+
implementation.
|
|
18
|
+
|
|
19
|
+
Attributes
|
|
20
|
+
----------
|
|
21
|
+
timestamps : bool, default=True
|
|
22
|
+
Controls whether timestamps are displayed in console output. When enabled,
|
|
23
|
+
all console messages will include timestamp prefixes for better debugging
|
|
24
|
+
and logging capabilities.
|
|
25
|
+
signature : str
|
|
26
|
+
The command signature string that defines the command name and expected
|
|
27
|
+
arguments format. Used for command registration in the console system
|
|
28
|
+
and automatic help text generation. Must follow the framework's signature
|
|
29
|
+
format conventions.
|
|
30
|
+
description : str
|
|
31
|
+
Human-readable description explaining the command's purpose and functionality.
|
|
32
|
+
This text is displayed in help documentation, command listings, and usage
|
|
33
|
+
instructions to assist users in understanding the command's capabilities.
|
|
34
|
+
_args : Dict[str, Any]
|
|
35
|
+
Dictionary containing parsed command-line arguments and options passed to
|
|
36
|
+
the command during execution. Populated automatically by the command parser
|
|
37
|
+
before the handle() method is called, providing structured access to all
|
|
38
|
+
user-provided input parameters.
|
|
39
|
+
arguments : List[CLIArgument]
|
|
40
|
+
List of CLIArgument instances defining the command's accepted arguments
|
|
41
|
+
and options. Used for argument parsing, validation, and help text generation.
|
|
42
|
+
|
|
43
|
+
Methods
|
|
44
|
+
-------
|
|
45
|
+
handle() -> None
|
|
46
|
+
Abstract method that must be implemented by all concrete command subclasses.
|
|
47
|
+
Contains the main execution logic specific to each command type and handles
|
|
48
|
+
argument processing, business logic execution, and output generation.
|
|
49
|
+
|
|
50
|
+
Notes
|
|
51
|
+
-----
|
|
52
|
+
- All concrete implementations must override the handle() method
|
|
53
|
+
- Command signatures should follow framework naming conventions
|
|
54
|
+
- Use self._args dictionary to access parsed command-line arguments
|
|
55
|
+
- Implement proper error handling and validation within command logic
|
|
56
|
+
- Follow single responsibility principle for maintainable command structure
|
|
57
|
+
- Utilize framework's console output methods for consistent user experience
|
|
58
|
+
|
|
59
|
+
See Also
|
|
60
|
+
--------
|
|
61
|
+
abc.ABC : Abstract base class functionality
|
|
62
|
+
typing.Dict : Type hints for argument dictionary structure
|
|
63
|
+
"""
|
|
64
|
+
|
|
65
|
+
# Enable timestamps in console output by default
|
|
66
|
+
timestamps: bool = True
|
|
67
|
+
|
|
68
|
+
# Command signature string for registration and help text generation
|
|
69
|
+
signature: str
|
|
70
|
+
|
|
71
|
+
# Human-readable description for documentation and help display
|
|
72
|
+
description: str
|
|
73
|
+
|
|
74
|
+
# Dictionary to store parsed command-line arguments and options
|
|
75
|
+
_args: Dict[str, Any] = {}
|
|
76
|
+
|
|
77
|
+
# List of CLIArgument instances defining command arguments
|
|
78
|
+
arguments: List[CLIArgument] = []
|
|
79
|
+
|
|
80
|
+
@abstractmethod
|
|
81
|
+
def handle(self) -> None:
|
|
82
|
+
"""
|
|
83
|
+
Execute the main logic of the console command.
|
|
84
|
+
|
|
85
|
+
This abstract method serves as the primary entry point for command execution
|
|
86
|
+
and must be implemented by all concrete command subclasses. The method contains
|
|
87
|
+
the core business logic specific to each command type and is responsible for
|
|
88
|
+
processing the parsed arguments stored in self.args and producing the desired
|
|
89
|
+
output or side effects.
|
|
90
|
+
|
|
91
|
+
The implementation should access parsed command-line arguments through the
|
|
92
|
+
self.args dictionary and utilize appropriate console output methods for
|
|
93
|
+
user feedback and result presentation. Error handling and resource cleanup
|
|
94
|
+
should also be managed within this method to ensure robust command execution.
|
|
95
|
+
|
|
96
|
+
Returns
|
|
97
|
+
-------
|
|
98
|
+
None
|
|
99
|
+
This method does not return any value. All command output, results,
|
|
100
|
+
error messages, and user feedback should be handled through console
|
|
101
|
+
output methods, file operations, database transactions, or other
|
|
102
|
+
side effects rather than return values.
|
|
103
|
+
|
|
104
|
+
Raises
|
|
105
|
+
------
|
|
106
|
+
NotImplementedError
|
|
107
|
+
Automatically raised when this method is called on the abstract base
|
|
108
|
+
class without a concrete implementation. All subclasses must override
|
|
109
|
+
this method with their specific command logic to avoid this exception.
|
|
110
|
+
|
|
111
|
+
Notes
|
|
112
|
+
-----
|
|
113
|
+
- Access command arguments and options via the self.args dictionary
|
|
114
|
+
- Use framework's console output methods for consistent user interaction
|
|
115
|
+
- Implement comprehensive error handling and input validation
|
|
116
|
+
- Ensure proper cleanup of resources (files, connections, etc.) if needed
|
|
117
|
+
- Follow the single responsibility principle for maintainable command logic
|
|
118
|
+
- Handle both success and failure scenarios appropriately
|
|
119
|
+
"""
|
|
120
|
+
|
|
121
|
+
# Abstract method placeholder - concrete implementations must override this method
|
|
122
|
+
# Each subclass should replace this pass statement with specific command logic
|
|
123
|
+
pass
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
from abc import ABC, abstractmethod
|
|
2
|
+
from typing import Any
|
|
3
|
+
|
|
4
|
+
class ICLIRequest(ABC):
|
|
5
|
+
|
|
6
|
+
@abstractmethod
|
|
7
|
+
def command(self) -> str:
|
|
8
|
+
"""
|
|
9
|
+
Retrieve the command name associated with this CLI request.
|
|
10
|
+
|
|
11
|
+
This method provides access to the command string that was specified during
|
|
12
|
+
the initialization of the CLIRequest object. The command represents the
|
|
13
|
+
primary action or operation that should be executed based on the CLI input.
|
|
14
|
+
|
|
15
|
+
Returns
|
|
16
|
+
-------
|
|
17
|
+
str
|
|
18
|
+
The command name stored as a string. This is the exact command value
|
|
19
|
+
that was passed to the constructor during object initialization.
|
|
20
|
+
|
|
21
|
+
Notes
|
|
22
|
+
-----
|
|
23
|
+
The returned command string is immutable and represents the core action
|
|
24
|
+
identifier for this CLI request. This value is essential for determining
|
|
25
|
+
which operation should be performed by the CLI handler.
|
|
26
|
+
"""
|
|
27
|
+
pass
|
|
28
|
+
|
|
29
|
+
@abstractmethod
|
|
30
|
+
def all(self) -> dict:
|
|
31
|
+
"""
|
|
32
|
+
Retrieve all command line arguments as a complete dictionary.
|
|
33
|
+
|
|
34
|
+
This method provides access to the entire collection of command line arguments
|
|
35
|
+
that were passed during the initialization of the CLIRequest object. It returns
|
|
36
|
+
a reference to the internal arguments dictionary, allowing for comprehensive
|
|
37
|
+
access to all parsed CLI parameters.
|
|
38
|
+
|
|
39
|
+
Returns
|
|
40
|
+
-------
|
|
41
|
+
dict
|
|
42
|
+
A dictionary containing all the parsed command line arguments as key-value
|
|
43
|
+
pairs, where keys are argument names (str) and values are the corresponding
|
|
44
|
+
argument values of any type. If no arguments were provided during
|
|
45
|
+
initialization, returns an empty dictionary.
|
|
46
|
+
|
|
47
|
+
Notes
|
|
48
|
+
-----
|
|
49
|
+
This method returns a reference to the internal arguments dictionary rather
|
|
50
|
+
than a copy. Modifications to the returned dictionary will affect the
|
|
51
|
+
internal state of the CLIRequest object.
|
|
52
|
+
"""
|
|
53
|
+
pass
|
|
54
|
+
|
|
55
|
+
@abstractmethod
|
|
56
|
+
def argument(self, name: str, default: Any = None):
|
|
57
|
+
"""
|
|
58
|
+
Retrieve the value of a specific command line argument by its name.
|
|
59
|
+
|
|
60
|
+
This method provides access to individual command line arguments that were
|
|
61
|
+
passed during initialization. It safely retrieves argument values without
|
|
62
|
+
raising exceptions if the argument doesn't exist.
|
|
63
|
+
|
|
64
|
+
Parameters
|
|
65
|
+
----------
|
|
66
|
+
name : str
|
|
67
|
+
The name of the command line argument to retrieve. This should match
|
|
68
|
+
the key used when the argument was originally parsed and stored.
|
|
69
|
+
default : Any, optional
|
|
70
|
+
The default value to return if the specified argument name does not
|
|
71
|
+
exist in the arguments dictionary. Defaults to None.
|
|
72
|
+
|
|
73
|
+
Returns
|
|
74
|
+
-------
|
|
75
|
+
Any or None
|
|
76
|
+
The value associated with the specified argument name if it exists
|
|
77
|
+
in the arguments dictionary. Returns None if the argument name is
|
|
78
|
+
not found or was not provided during CLI execution.
|
|
79
|
+
|
|
80
|
+
Notes
|
|
81
|
+
-----
|
|
82
|
+
This method uses the dictionary's get() method to safely access values,
|
|
83
|
+
ensuring that missing arguments return None rather than raising a KeyError.
|
|
84
|
+
"""
|
|
85
|
+
pass
|
|
@@ -1,123 +1,105 @@
|
|
|
1
1
|
from abc import ABC, abstractmethod
|
|
2
|
-
from
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
See Also
|
|
60
|
-
--------
|
|
61
|
-
abc.ABC : Abstract base class functionality
|
|
62
|
-
typing.Dict : Type hints for argument dictionary structure
|
|
63
|
-
"""
|
|
64
|
-
|
|
65
|
-
# Enable timestamps in console output by default
|
|
66
|
-
timestamps: bool = True
|
|
67
|
-
|
|
68
|
-
# Command signature string for registration and help text generation
|
|
69
|
-
signature: str
|
|
70
|
-
|
|
71
|
-
# Human-readable description for documentation and help display
|
|
72
|
-
description: str
|
|
73
|
-
|
|
74
|
-
# Dictionary to store parsed command-line arguments and options
|
|
75
|
-
_args: Dict[str, Any] = {}
|
|
76
|
-
|
|
77
|
-
# List of CLIArgument instances defining command arguments
|
|
78
|
-
arguments: List[CLIArgument] = []
|
|
2
|
+
from orionis.console.entities.command import Command as CommandEntity
|
|
3
|
+
|
|
4
|
+
class ICommand(ABC):
|
|
5
|
+
|
|
6
|
+
@abstractmethod
|
|
7
|
+
def timestamp(self, enabled: bool = True) -> 'ICommand':
|
|
8
|
+
"""
|
|
9
|
+
Configure whether timestamps should be included in command output.
|
|
10
|
+
|
|
11
|
+
This method allows enabling or disabling timestamp display for the command.
|
|
12
|
+
When enabled, timestamps will be shown alongside command execution results.
|
|
13
|
+
|
|
14
|
+
Parameters
|
|
15
|
+
----------
|
|
16
|
+
enabled : bool, default=True
|
|
17
|
+
Flag to enable or disable timestamp display. True enables timestamps,
|
|
18
|
+
False disables them.
|
|
19
|
+
|
|
20
|
+
Returns
|
|
21
|
+
-------
|
|
22
|
+
Command
|
|
23
|
+
Returns the current Command instance to allow method chaining.
|
|
24
|
+
|
|
25
|
+
Raises
|
|
26
|
+
------
|
|
27
|
+
TypeError
|
|
28
|
+
If the enabled parameter is not a boolean value.
|
|
29
|
+
"""
|
|
30
|
+
pass
|
|
31
|
+
|
|
32
|
+
@abstractmethod
|
|
33
|
+
def description(self, desc: str) -> 'ICommand':
|
|
34
|
+
"""
|
|
35
|
+
Set the description for the command.
|
|
36
|
+
|
|
37
|
+
This method allows setting a descriptive text that explains what the command
|
|
38
|
+
does. The description is used for help text and documentation purposes when
|
|
39
|
+
displaying command information to users.
|
|
40
|
+
|
|
41
|
+
Parameters
|
|
42
|
+
----------
|
|
43
|
+
desc : str
|
|
44
|
+
The description text for the command. Must be a non-empty string that
|
|
45
|
+
describes the command's purpose and functionality.
|
|
46
|
+
|
|
47
|
+
Returns
|
|
48
|
+
-------
|
|
49
|
+
Command
|
|
50
|
+
Returns the current Command instance to allow method chaining.
|
|
51
|
+
|
|
52
|
+
Raises
|
|
53
|
+
------
|
|
54
|
+
TypeError
|
|
55
|
+
If the desc parameter is not a string value.
|
|
56
|
+
"""
|
|
57
|
+
pass
|
|
79
58
|
|
|
80
59
|
@abstractmethod
|
|
81
|
-
def
|
|
60
|
+
def arguments(self, args: list) -> 'ICommand':
|
|
82
61
|
"""
|
|
83
|
-
|
|
62
|
+
Set the list of CLI arguments for the command.
|
|
84
63
|
|
|
85
|
-
This
|
|
86
|
-
|
|
87
|
-
the
|
|
88
|
-
|
|
89
|
-
output or side effects.
|
|
64
|
+
This method configures the command-line arguments that the command will accept.
|
|
65
|
+
Each argument must be a properly configured CLIArgument instance that defines
|
|
66
|
+
the argument's name, type, validation rules, and other properties. The arguments
|
|
67
|
+
are used during command parsing to validate and process user input.
|
|
90
68
|
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
69
|
+
Parameters
|
|
70
|
+
----------
|
|
71
|
+
args : list
|
|
72
|
+
A list of CLIArgument instances that define the command's accepted arguments.
|
|
73
|
+
Each element in the list must be a valid CLIArgument object with proper
|
|
74
|
+
configuration for argument parsing and validation.
|
|
95
75
|
|
|
96
76
|
Returns
|
|
97
77
|
-------
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
output methods, file operations, database transactions, or other
|
|
102
|
-
side effects rather than return values.
|
|
78
|
+
Command
|
|
79
|
+
Returns the current Command instance to allow method chaining and enable
|
|
80
|
+
fluent interface pattern for command configuration.
|
|
103
81
|
|
|
104
82
|
Raises
|
|
105
83
|
------
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
- Use framework's console output methods for consistent user interaction
|
|
115
|
-
- Implement comprehensive error handling and input validation
|
|
116
|
-
- Ensure proper cleanup of resources (files, connections, etc.) if needed
|
|
117
|
-
- Follow the single responsibility principle for maintainable command logic
|
|
118
|
-
- Handle both success and failure scenarios appropriately
|
|
84
|
+
TypeError
|
|
85
|
+
If the args parameter is not a list, or if any element in the list
|
|
86
|
+
is not an instance of CLIArgument.
|
|
87
|
+
"""
|
|
88
|
+
pass
|
|
89
|
+
|
|
90
|
+
@abstractmethod
|
|
91
|
+
def get(self) -> tuple[str, CommandEntity]:
|
|
119
92
|
"""
|
|
93
|
+
Retrieve the configured Command entity.
|
|
120
94
|
|
|
121
|
-
|
|
122
|
-
|
|
95
|
+
This method constructs and returns a Command entity object that encapsulates
|
|
96
|
+
all the configuration details of the command, including its signature, concrete
|
|
97
|
+
class, method, description, arguments, and timestamp setting. The returned
|
|
98
|
+
Command entity can be used for command execution and management.
|
|
99
|
+
|
|
100
|
+
Returns
|
|
101
|
+
-------
|
|
102
|
+
CommandEntity
|
|
103
|
+
A Command entity object containing all the command's configuration details.
|
|
104
|
+
"""
|
|
123
105
|
pass
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
from abc import ABC, abstractmethod
|
|
2
2
|
from datetime import datetime
|
|
3
3
|
from orionis.console.contracts.schedule_event_listener import IScheduleEventListener
|
|
4
|
-
from orionis.console.
|
|
4
|
+
from orionis.console.entities.event import Event as EventEntity
|
|
5
5
|
|
|
6
6
|
class IEvent(ABC):
|
|
7
7
|
|
|
@@ -1,8 +1,48 @@
|
|
|
1
1
|
from abc import ABC, abstractmethod
|
|
2
2
|
from typing import Any, List, Optional
|
|
3
|
+
from orionis.console.contracts.command import ICommand
|
|
3
4
|
|
|
4
5
|
class IReactor(ABC):
|
|
5
6
|
|
|
7
|
+
@abstractmethod
|
|
8
|
+
def command(
|
|
9
|
+
self,
|
|
10
|
+
signature: str,
|
|
11
|
+
handler: Any
|
|
12
|
+
) -> ICommand:
|
|
13
|
+
"""
|
|
14
|
+
Define a new command using a fluent interface.
|
|
15
|
+
|
|
16
|
+
This method allows defining a new command with a specified signature and handler
|
|
17
|
+
function using a fluent interface pattern. The command can be further configured
|
|
18
|
+
by chaining additional method calls to set properties such as timestamps,
|
|
19
|
+
description, and arguments.
|
|
20
|
+
|
|
21
|
+
Parameters
|
|
22
|
+
----------
|
|
23
|
+
signature : str
|
|
24
|
+
The unique signature identifier for the command. Must follow naming conventions
|
|
25
|
+
(alphanumeric characters, underscores, colons, cannot start/end with underscore
|
|
26
|
+
or colon, cannot start with a number).
|
|
27
|
+
handler : Any
|
|
28
|
+
The function or callable that will be executed when the command is invoked.
|
|
29
|
+
This should be a valid function that accepts parameters matching the command's
|
|
30
|
+
defined arguments.
|
|
31
|
+
|
|
32
|
+
Returns
|
|
33
|
+
-------
|
|
34
|
+
ICommand
|
|
35
|
+
Returns an instance of ICommand that allows further configuration of the command
|
|
36
|
+
through method chaining.
|
|
37
|
+
|
|
38
|
+
Raises
|
|
39
|
+
------
|
|
40
|
+
TypeError
|
|
41
|
+
If the signature is not a string or if the handler is not callable.
|
|
42
|
+
ValueError
|
|
43
|
+
If the signature does not meet the required naming conventions.
|
|
44
|
+
"""
|
|
45
|
+
|
|
6
46
|
@abstractmethod
|
|
7
47
|
def info(self) -> List[dict]:
|
|
8
48
|
"""
|