cli-ih 0.6.0.2.1__py3-none-any.whl → 0.6.1.1__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.
- cli_ih/Input_Handler.py +10 -11
- {cli_ih-0.6.0.2.1.dist-info → cli_ih-0.6.1.1.dist-info}/METADATA +1 -1
- cli_ih-0.6.1.1.dist-info/RECORD +6 -0
- cli_ih-0.6.0.2.1.dist-info/RECORD +0 -6
- {cli_ih-0.6.0.2.1.dist-info → cli_ih-0.6.1.1.dist-info}/WHEEL +0 -0
- {cli_ih-0.6.0.2.1.dist-info → cli_ih-0.6.1.1.dist-info}/top_level.txt +0 -0
cli_ih/Input_Handler.py
CHANGED
|
@@ -85,12 +85,14 @@ class InputHandler:
|
|
|
85
85
|
if command:
|
|
86
86
|
func = command.get("cmd")
|
|
87
87
|
if callable(func):
|
|
88
|
-
#if str(inspect.signature(func)) == "()":
|
|
89
|
-
#raise MissingParameter(f"Command '{name}' must accept an 'args' parameter")
|
|
90
88
|
try:
|
|
91
|
-
func
|
|
89
|
+
sig = inspect.signature(func)
|
|
90
|
+
sig.bind(*args)
|
|
92
91
|
except TypeError as e:
|
|
93
|
-
self.
|
|
92
|
+
self.__warning(f"Argument error for command '{name}': {e}")
|
|
93
|
+
return
|
|
94
|
+
try:
|
|
95
|
+
func(*args)
|
|
94
96
|
except HandlerClosed as e:
|
|
95
97
|
raise e
|
|
96
98
|
except Exception as e:
|
|
@@ -134,14 +136,14 @@ class InputHandler:
|
|
|
134
136
|
|
|
135
137
|
def register_default_commands(self):
|
|
136
138
|
@self.command(name="help", description="Displays all the available commands")
|
|
137
|
-
def help(
|
|
139
|
+
def help():
|
|
138
140
|
str_out = "Available commands:\n"
|
|
139
141
|
for command, data in self.commands.items():
|
|
140
142
|
str_out += f" {command}: {data['description']}\n"
|
|
141
143
|
print(str_out)
|
|
142
144
|
|
|
143
145
|
@self.command(name="debug", description="If a logger is present changes the logging level to DEBUG.")
|
|
144
|
-
def debug_mode(
|
|
146
|
+
def debug_mode():
|
|
145
147
|
logger = self.global_logger
|
|
146
148
|
if not logger:
|
|
147
149
|
return self.__warning("No logger defined for this InputHandler instance.")
|
|
@@ -161,8 +163,5 @@ class InputHandler:
|
|
|
161
163
|
self.__info(message)
|
|
162
164
|
|
|
163
165
|
@self.command(name="exit", description="Exits the Input Handler irreversibly.")
|
|
164
|
-
def exit_thread(
|
|
165
|
-
raise HandlerClosed("Handler was closed with exit command.")
|
|
166
|
-
# self.register_command("help", help, "Displays all the available commands")
|
|
167
|
-
# self.register_command("debug", debug_mode, "Changes the logging level to DEBUG.")
|
|
168
|
-
# self.register_command("exit", exit_thread, "Exits the Input Handler irreversibly.")
|
|
166
|
+
def exit_thread():
|
|
167
|
+
raise HandlerClosed("Handler was closed with exit command.")
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
cli_ih/Input_Handler.py,sha256=NvmaLOBgip76tU3NN_NYKfGXi8y2X6bdeNqkM0W7Iyc,6588
|
|
2
|
+
cli_ih/__init__.py,sha256=X1CBDfeflUjcXik3rHCo-YLrIDe6EsH2ShnK57DDRYc,210
|
|
3
|
+
cli_ih-0.6.1.1.dist-info/METADATA,sha256=14APY3HexSeaVdMcH6Tyq1nZbLCDecwW9elapo66C00,2239
|
|
4
|
+
cli_ih-0.6.1.1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
5
|
+
cli_ih-0.6.1.1.dist-info/top_level.txt,sha256=Ve1CRLNXhPyPSkpN0xLu26roh30LQCpNzkF61BZYfk0,7
|
|
6
|
+
cli_ih-0.6.1.1.dist-info/RECORD,,
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
cli_ih/Input_Handler.py,sha256=INlPvqlHHzN2tEDj4WUtztd2VkZZjT9FloGNSdQKc1Y,6876
|
|
2
|
-
cli_ih/__init__.py,sha256=X1CBDfeflUjcXik3rHCo-YLrIDe6EsH2ShnK57DDRYc,210
|
|
3
|
-
cli_ih-0.6.0.2.1.dist-info/METADATA,sha256=sztmZuw7GXAIvi-VSPXlO8SbEch9fdok1LKScvyRvik,2241
|
|
4
|
-
cli_ih-0.6.0.2.1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
5
|
-
cli_ih-0.6.0.2.1.dist-info/top_level.txt,sha256=Ve1CRLNXhPyPSkpN0xLu26roh30LQCpNzkF61BZYfk0,7
|
|
6
|
-
cli_ih-0.6.0.2.1.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|