From 9b2212245f8c3f53ad4845fe69dffcf708eac7bb Mon Sep 17 00:00:00 2001 From: Hemna Date: Wed, 20 Oct 2021 11:46:55 -0400 Subject: [PATCH] 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. --- aprsd/dev.py | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/aprsd/dev.py b/aprsd/dev.py index aecb2c3..f4477f5 100644 --- a/aprsd/dev.py +++ b/aprsd/dev.py @@ -187,6 +187,14 @@ def setup_logging(config, loglevel, quiet): default=False, 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("message", nargs=-1, required=True) def test_plugin( @@ -194,6 +202,7 @@ def test_plugin( config_file, plugin_path, load_all, + number, fromcall, message, ): @@ -225,11 +234,12 @@ def test_plugin( "msgNo": 1, } - reply = pm.run(packet) + for x in range(number): + reply = pm.run(packet) + # Plugin might have threads, so lets stop them so we can exit. + # obj.stop_threads() + LOG.info(f"Result{x} = '{reply}'") pm.stop() - # Plugin might have threads, so lets stop them so we can exit. - # obj.stop_threads() - LOG.info(f"Result = '{reply}'") if __name__ == "__main__":