Skip to content

Commit f6ab5ed

Browse files
committed
hooks: add args to run
1 parent 3695546 commit f6ab5ed

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/warnet/hooks.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,8 @@ def toggle(plugin: str):
9999
@plugin.command()
100100
@click.argument("plugin", type=str)
101101
@click.argument("function", type=str)
102-
def run(plugin: str, function: str):
102+
@click.argument("args", nargs=-1, type=str) # Accepts zero or more arguments
103+
def run(plugin: str, function: str, args: tuple[str, ...]):
103104
"""Run a command available in a plugin"""
104105
plugin_dir = _get_plugin_directory()
105106
plugins = get_plugins_with_status(plugin_dir)
@@ -113,7 +114,7 @@ def run(plugin: str, function: str):
113114
if hasattr(module, function):
114115
func = getattr(module, function)
115116
if callable(func):
116-
result = func()
117+
result = func(*args)
117118
print(result)
118119
else:
119120
click.secho(f"{function} in {module} is not callable.")

0 commit comments

Comments
 (0)