cli-ih 0.6.0.2__tar.gz → 0.6.0.2.1__tar.gz
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-0.6.0.2 → cli_ih-0.6.0.2.1}/PKG-INFO +1 -1
- {cli_ih-0.6.0.2 → cli_ih-0.6.0.2.1}/cli_ih/Input_Handler.py +7 -4
- {cli_ih-0.6.0.2 → cli_ih-0.6.0.2.1}/cli_ih.egg-info/PKG-INFO +1 -1
- {cli_ih-0.6.0.2 → cli_ih-0.6.0.2.1}/pyproject.toml +1 -1
- {cli_ih-0.6.0.2 → cli_ih-0.6.0.2.1}/README.md +0 -0
- {cli_ih-0.6.0.2 → cli_ih-0.6.0.2.1}/cli_ih/__init__.py +0 -0
- {cli_ih-0.6.0.2 → cli_ih-0.6.0.2.1}/cli_ih.egg-info/SOURCES.txt +0 -0
- {cli_ih-0.6.0.2 → cli_ih-0.6.0.2.1}/cli_ih.egg-info/dependency_links.txt +0 -0
- {cli_ih-0.6.0.2 → cli_ih-0.6.0.2.1}/cli_ih.egg-info/top_level.txt +0 -0
- {cli_ih-0.6.0.2 → cli_ih-0.6.0.2.1}/setup.cfg +0 -0
|
@@ -52,22 +52,25 @@ class InputHandler:
|
|
|
52
52
|
else:
|
|
53
53
|
print(f"[EXEPTION]: {msg}: {e}")
|
|
54
54
|
|
|
55
|
-
def
|
|
56
|
-
"""Registers a command with its associated function."""
|
|
57
|
-
warnings.warn("Registering commands with `register_command` is deprecated, and will be removed in the next big update.", DeprecationWarning, 2)
|
|
55
|
+
def __register_cmd(self, name: str, func: Callable, description: str = ""):
|
|
58
56
|
if not description:
|
|
59
57
|
description = "A command"
|
|
60
58
|
if ' ' in name:
|
|
61
59
|
raise SyntaxError("Command name must not have spaces")
|
|
62
60
|
self.commands[name] = {"cmd": func, "description": description}
|
|
63
61
|
|
|
62
|
+
def register_command(self, name: str, func: Callable, description: str = ""):
|
|
63
|
+
"""Registers a command with its associated function."""
|
|
64
|
+
warnings.warn("Registering commands with `register_command` is deprecated, and will be removed in the next big update.", DeprecationWarning, 2)
|
|
65
|
+
self.__register_cmd(name, func, description)
|
|
66
|
+
|
|
64
67
|
def command(self, *, name: str = "", description: str = ""):
|
|
65
68
|
"""Registers a command with its associated function as a decorator."""
|
|
66
69
|
def decorator(func: Callable):
|
|
67
70
|
lname = name
|
|
68
71
|
if not lname:
|
|
69
72
|
lname = func.__name__
|
|
70
|
-
self.
|
|
73
|
+
self.__register_cmd(lname, func, description)
|
|
71
74
|
return func
|
|
72
75
|
return decorator
|
|
73
76
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|