-
Notifications
You must be signed in to change notification settings - Fork 164
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Load a message/request/goal from standard input #844
Conversation
Signed-off-by: ymd-stella <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In general, this looks good to me. I've left one suggestion for improvement.
if args.stdin: | ||
lines = b"" | ||
while True: | ||
line = sys.stdin.buffer.readline() | ||
if not line: | ||
break | ||
lines += line | ||
args.goal = lines |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since we have this exact same stanza in multiple files, I'm going to suggest that we move this into a function in https://github.com/ros2/ros2cli/blob/rolling/ros2cli/ros2cli/helpers.py . That way we'll have less duplicated code. Then this will be something like:
if args.stdin: | |
lines = b"" | |
while True: | |
line = sys.stdin.buffer.readline() | |
if not line: | |
break | |
lines += line | |
args.goal = lines | |
if args.stdin: | |
arg.goal = utils.collect_stdin() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is getting closer, a few more things to fix.
Signed-off-by: ymd-stella <[email protected]>
1257335
to
0a4196a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good to me, thank you!
Signed-off-by: ymd-stella <[email protected]>
* Load a message/request/goal from standard input Signed-off-by: ymd-stella <[email protected]>
Resolve #842
Add option
--stdin
to pass yaml from standard input.The last positional argument and the new option
--stdin
are mutually_exclusive_group.The change requires that the send_goal argument
goal
be optional.