From 2ddedadc03eb72dc1ff39d74bfe99a3f84fa315c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Romain=20BRON=C3=88S?= <romain.brones@synchrotron-soleil.fr> Date: Thu, 29 Feb 2024 09:22:36 +0100 Subject: [PATCH] feat(cli): Add the mossibility to dump configuration * Also specify in doctring of load config that configuration are superseded --- FofbTool/Configuration.py | 2 +- scripts/FofbTool | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/FofbTool/Configuration.py b/FofbTool/Configuration.py index 4ee6d4e..4afd8db 100644 --- a/FofbTool/Configuration.py +++ b/FofbTool/Configuration.py @@ -38,7 +38,7 @@ def logdebugconf(): def loadconfig(filepath): """ Load a configuration file for the module. - It initialize the internal configuration. + It supersed the default configuration, if found. PARAMETERS ---------- diff --git a/scripts/FofbTool b/scripts/FofbTool index 168cf8b..3465b78 100755 --- a/scripts/FofbTool +++ b/scripts/FofbTool @@ -52,6 +52,9 @@ if __name__ == '__main__': parser.add_argument("--stop-ccn", action="store_true", help="Stop command for the ComBPM applications blocks.") + parser.add_argument("--dump-configuration", type=argparse.FileType('w'), + help="Dump the current configuration in a file at the giver path.") + parser.add_argument("--configure", choices=["combpm", "ccn", "comcorr", "corr", "all"], nargs='?', const='all', help="Configuration commands for the Fofb applications blocs."+ @@ -77,6 +80,11 @@ if __name__ == '__main__': FofbTool.Configuration.loadconfig(args.fileconfig) FofbTool.Configuration.logdebugconf() + if not args.dump_configuration is None: + FofbTool.Configuration.config.write(args.dump_configuration) + args.dump_configuration.close() + + ## Check running if not FofbTool.Utils.check_fofbnotrunning(): logger.warning("FOFB is running") -- GitLab