diff --git a/ros2bag/ros2bag/verb/record.py b/ros2bag/ros2bag/verb/record.py index b078176d5f..65d8dd2ea2 100644 --- a/ros2bag/ros2bag/verb/record.py +++ b/ros2bag/ros2bag/verb/record.py @@ -55,7 +55,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. ' @@ -168,12 +168,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')