From: Jérôme Benoit Date: Thu, 27 Jun 2024 23:08:41 +0000 (+0200) Subject: fix(ocpp-server): ensure the CLI options help is not truncated X-Git-Tag: v1.3.7~13^2~1 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=ba56e7c9946964b7c28adb72cd54eeb805194f25;p=e-mobility-charging-stations-simulator.git fix(ocpp-server): ensure the CLI options help is not truncated Signed-off-by: Jérôme Benoit --- diff --git a/tests/ocpp-server/server.py b/tests/ocpp-server/server.py index fdef6bed..483c750f 100644 --- a/tests/ocpp-server/server.py +++ b/tests/ocpp-server/server.py @@ -208,11 +208,8 @@ def check_positive_number(value: Optional[float]): # Main function to start the WebSocket server. async def main(): parser = argparse.ArgumentParser(description="OCPP2 Server") - parser.add_argument("-c", "--command", type=Action, help="OCPP2 command name") - parsed_args, _ = parser.parse_known_args() - group = parser.add_mutually_exclusive_group( - required=parsed_args.command is not None - ) + parser.add_argument("-c", "--command", type=Action, help="command name") + group = parser.add_mutually_exclusive_group() group.add_argument( "-d", "--delay", @@ -225,6 +222,7 @@ async def main(): type=check_positive_number, help="period in seconds", ) + group.required = parser.parse_known_args()[0].command is not None args = parser.parse_args() diff --git a/tests/ocpp-server/timer.py b/tests/ocpp-server/timer.py index aca74045..e81d05b9 100644 --- a/tests/ocpp-server/timer.py +++ b/tests/ocpp-server/timer.py @@ -12,7 +12,8 @@ class Timer: callback_args=(), callback_kwargs=None, ): - """An asynchronous Timer object. + """ + An asynchronous Timer object. Parameters ----------