From 49bf3de9258585644a3afc3745eac3b21fd49155 Mon Sep 17 00:00:00 2001 From: Tim Pillinger <26465611+wxtim@users.noreply.github.com> Date: Tue, 10 Dec 2024 14:11:36 +0000 Subject: [PATCH] Add a store for CLI variables for reload, which can then be accessed by both Cylc VR and Reload. Mirrors practice for VALIDATE, INSTALL, PLAY and RESTART --- cylc/flow/scripts/reload.py | 20 +++++++++++++++----- cylc/flow/scripts/validate_reinstall.py | 3 +++ 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/cylc/flow/scripts/reload.py b/cylc/flow/scripts/reload.py index 1d1b89ed991..c8e39989d1c 100755 --- a/cylc/flow/scripts/reload.py +++ b/cylc/flow/scripts/reload.py @@ -60,6 +60,7 @@ from cylc.flow.option_parsers import ( WORKFLOW_ID_MULTI_ARG_DOC, CylcOptionParser as COP, + OptionSettings, ) from cylc.flow.terminal import cli_function @@ -67,6 +68,18 @@ from optparse import Values +RELOAD_OPTIONS = [ + OptionSettings( + ['-g', '--global'], + help='also reload global configuration.', + action="store_true", + default=False, + dest="reload_global", + sources={'reload'} + ), +] + + MUTATION = ''' mutation ( $wFlows: [WorkflowID]!, @@ -89,11 +102,8 @@ def get_option_parser(): multiworkflow=True, argdoc=[WORKFLOW_ID_MULTI_ARG_DOC], ) - - parser.add_option( - "-g", "--global", - help="also reload global configuration.", - action="store_true", default=False, dest="reload_global") + for option in RELOAD_OPTIONS: + parser.add_option(*option.args, **option.kwargs) return parser diff --git a/cylc/flow/scripts/validate_reinstall.py b/cylc/flow/scripts/validate_reinstall.py index 4e78d673d7e..afb36ddeab4 100644 --- a/cylc/flow/scripts/validate_reinstall.py +++ b/cylc/flow/scripts/validate_reinstall.py @@ -73,6 +73,7 @@ reinstall_cli as cylc_reinstall, ) from cylc.flow.scripts.reload import ( + RELOAD_OPTIONS, run as cylc_reload ) from cylc.flow.terminal import cli_function @@ -86,6 +87,7 @@ VALIDATE_OPTIONS, REINSTALL_OPTIONS, REINSTALL_CYLC_ROSE_OPTIONS, + RELOAD_OPTIONS, PLAY_OPTIONS, CYLC_ROSE_OPTIONS, modify={'cylc-rose': 'validate, install'} @@ -102,6 +104,7 @@ def get_option_parser() -> COP: for option in VR_OPTIONS: parser.add_option(*option.args, **option.kwargs) parser.set_defaults(is_validate=True) + return parser