Skip to content

Commit

Permalink
[Humble] Resolve recording option problem (backport #1649) (#1651)
Browse files Browse the repository at this point in the history
* Resolve recording option problem (#1649)

Signed-off-by: Barry Xu <barry.xu@sony.com>
(cherry picked from commit 4914ab3)

# Conflicts:
#	ros2bag/ros2bag/verb/record.py

* Fix cherry-pick conflicts for mergify/bp/humble/pr-1649 (#1652)

Signed-off-by: Barry Xu <barry.xu@sony.com>

---------

Signed-off-by: Barry Xu <barry.xu@sony.com>
Co-authored-by: Barry Xu <barry.xu@sony.com>
  • Loading branch information
mergify[bot] and Barry-Xu-2018 authored May 11, 2024
1 parent e7f7f59 commit fae5926
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 @@ -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. '
Expand Down Expand Up @@ -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')
Expand Down

0 comments on commit fae5926

Please sign in to comment.