Skip to content

Commit

Permalink
Resolve recording option problem (#1649)
Browse files Browse the repository at this point in the history
Signed-off-by: Barry Xu <barry.xu@sony.com>
  • Loading branch information
Barry-Xu-2018 authored May 10, 2024
1 parent 809ca5a commit 4914ab3
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions ros2bag/ros2bag/verb/record.py
Original file line number Diff line number Diff line change
Expand Up @@ -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. '
Expand Down Expand Up @@ -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')
Expand Down

0 comments on commit 4914ab3

Please sign in to comment.