From 4914ab3600303bd740e417c1694a746277a5170c Mon Sep 17 00:00:00 2001 From: Barry Xu Date: Sat, 11 May 2024 06:44:06 +0800 Subject: [PATCH] Resolve recording option problem (#1649) Signed-off-by: Barry Xu --- ros2bag/ros2bag/verb/record.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/ros2bag/ros2bag/verb/record.py b/ros2bag/ros2bag/verb/record.py index 8c49c4b679..60599d5197 100644 --- a/ros2bag/ros2bag/verb/record.py +++ b/ros2bag/ros2bag/verb/record.py @@ -69,7 +69,7 @@ def add_arguments(self, parser, cli_name): # noqa: D102 parser.add_argument( '-e', '--regex', default='', help='Record only topics containing provided regular expression. ' - 'Overrides --all, applies on top of topics list.') + 'Applies on top of topics list.') parser.add_argument( '-x', '--exclude', default='', help='Exclude topics containing provided regular expression. ' @@ -169,12 +169,15 @@ def add_arguments(self, parser, cli_name): # noqa: D102 def main(self, *, args): # noqa: D102 # both all and topics cannot be true - if (args.all and (args.topics or args.regex)) or (args.topics and args.regex): - return print_error('Must specify only one option out of topics, --regex or --all') + if (args.all and args.topics): + return print_error('Specify either --all or topics, but not both simultaneously.') # one out of "all", "topics" and "regex" must be true if not(args.all or (args.topics and len(args.topics) > 0) or (args.regex)): return print_error('Invalid choice: Must specify topic(s), --regex or --all') + if args.all and args.regex: + print('[WARN] [ros2bag]: --all will override --regex.') + if args.topics and args.exclude: return print_error('--exclude argument cannot be used when specifying a list ' 'of topics explicitly')