1
0
mirror of https://github.com/craigerl/aprsd.git synced 2025-08-04 14:32:24 -04:00

Added -num option to aprsd-dev test-plugin

This allows the user to specify how many times in a loop
to call the plugin.  The Default is 1.
This commit is contained in:
Hemna 2021-10-20 11:46:55 -04:00
parent 9150f3b6ff
commit 9b2212245f

View File

@ -187,6 +187,14 @@ def setup_logging(config, loglevel, quiet):
default=False, default=False,
help="Load all the plugins in config?", help="Load all the plugins in config?",
) )
@click.option(
"-n",
"--num",
"number",
show_default=True,
default=1,
help="Number of times to call the plugin",
)
@click.argument("fromcall") @click.argument("fromcall")
@click.argument("message", nargs=-1, required=True) @click.argument("message", nargs=-1, required=True)
def test_plugin( def test_plugin(
@ -194,6 +202,7 @@ def test_plugin(
config_file, config_file,
plugin_path, plugin_path,
load_all, load_all,
number,
fromcall, fromcall,
message, message,
): ):
@ -225,11 +234,12 @@ def test_plugin(
"msgNo": 1, "msgNo": 1,
} }
for x in range(number):
reply = pm.run(packet) reply = pm.run(packet)
pm.stop()
# Plugin might have threads, so lets stop them so we can exit. # Plugin might have threads, so lets stop them so we can exit.
# obj.stop_threads() # obj.stop_threads()
LOG.info(f"Result = '{reply}'") LOG.info(f"Result{x} = '{reply}'")
pm.stop()
if __name__ == "__main__": if __name__ == "__main__":