From 29e8daa719a2f1e6914c22743380a962f1c04fab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20Fra=C3=9F?= Date: Tue, 29 Apr 2025 20:19:45 +0000 Subject: [PATCH] [add] option:single-run --- source/main.ts | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/source/main.ts b/source/main.ts index 51800cd..f64b508 100644 --- a/source/main.ts +++ b/source/main.ts @@ -107,8 +107,10 @@ namespace _munin async function run( conf : _munin.conf.type_conf, { + "single_run": single_run = false, "dry_run": dry_run = false, } : { + single_run ?: boolean; dry_run ?: boolean; } = { } @@ -127,9 +129,14 @@ namespace _munin } } ); - while (true) { + if (single_run) { await run_iteration(conf, sources, targets, {"dry_run": dry_run}); - await lib_plankton.call.sleep(conf.settings.interval * 60 * 60); + } + else { + while (true) { + await run_iteration(conf, sources, targets, {"dry_run": dry_run}); + await lib_plankton.call.sleep(conf.settings.interval * 60 * 60); + } } } @@ -171,6 +178,15 @@ namespace _munin "info": "whether to expose the full configuration", "name": "conf-expose", }), + "single_run": lib_plankton.args.class_argument.volatile({ + "indicators_long": ["single-run"], + "indicators_short": ["s"], + "type": lib_plankton.args.enum_type.boolean, + "mode": lib_plankton.args.enum_mode.replace, + "default": false, + "info": "whether to only execute on iteration at run", + "name": "single-run", + }), "verbosity": lib_plankton.args.class_argument.volatile({ "indicators_long": ["verbosity"], "indicators_short": ["v"], @@ -274,6 +290,7 @@ namespace _munin run( conf, { + "single_run": args.single_run, "dry_run": args.dry_run, } );