Conversation
dirk-thomas
left a comment
There was a problem hiding this comment.
I don't think the actually read data from stdin should be the default value. When you call --help the default value would also be different.
Btw calling ros2 interface show results in an exception atm.
Also the usage / help doesn't give any indicator that the type can be piped in.
|
I've attached an action to
rather than
This also replaces reading I've also added more information in the help but I'm not sure if it's written clearly enough, or if there's a convention that I'm breaking. |
|
Thanks for the updates. I applies a few changes. Please have a look:
|
|
@sharminramli It would be great if you could add a unit test to cover this new feature to avoid it regressing in the future. |
@sharminramli Friendly ping. |
|
@dirk-thomas Sorry about the delay. Thanks for the changes, they look great. I started working on the unit tests, but I ran into some issues piping stdin to the test process. I am patching a mock stdin to the test function with but it appears to hang at |
|
@sharminramli you won't be able to pipe data into the launched process like that. command_action = ExecuteProcess(
cmd=[sys.executable, '-c', "print('std_msgs/msg/String')", '|', 'ros2', 'interface', 'show', '-'],
shell=True,
output='screen'
)Alternatively, you can propose a reasonable way to expose the |
|
@sharminramli Friendly ping. |
|
@dirk-thomas Sorry for the wait. I've added the test as |
|
Rebased and changed the test to use |
That was fixed in #516. As a result, this now needs a rebase. |
Signed-off-by: Nursharmin Ramli <nursharminramli@gmail.com>
Signed-off-by: Dirk Thomas <dirk-thomas@users.noreply.github.com>
Signed-off-by: Dirk Thomas <dirk-thomas@users.noreply.github.com>
Signed-off-by: Dirk Thomas <dirk-thomas@users.noreply.github.com>
Signed-off-by: Dirk Thomas <dirk-thomas@users.noreply.github.com>
Signed-off-by: Nursharmin Ramli <nursharminramli@gmail.com>
Signed-off-by: Nursharmin Ramli <nursharminramli@gmail.com>
Signed-off-by: Nursharmin Ramli <nursharminramli@gmail.com>
|
Rebased and changed the help message to refer to |
|
Thanks for re-running CI @audrow ! |
|
Alright, thank you for contribution and your patience @sharminramli ! Merging. |
* Allow stdin input for 'ros2 interface show' Signed-off-by: Nursharmin Ramli <nursharminramli@gmail.com> * just use help for all the information Signed-off-by: Dirk Thomas <dirk-thomas@users.noreply.github.com> * fix import order Signed-off-by: Dirk Thomas <dirk-thomas@users.noreply.github.com> * simplify logic Signed-off-by: Dirk Thomas <dirk-thomas@users.noreply.github.com> * catch empty values in case stdin doesn't contain output Signed-off-by: Dirk Thomas <dirk-thomas@users.noreply.github.com> * Add test for 'ros2 interface show' with stdin Signed-off-by: Nursharmin Ramli <nursharminramli@gmail.com> * Use test_msgs instead of std_msgs for stdin test Signed-off-by: Nursharmin Ramli <nursharminramli@gmail.com> * Use example_interfaces in help for show Signed-off-by: Nursharmin Ramli <nursharminramli@gmail.com> Co-authored-by: Dirk Thomas <dirk-thomas@users.noreply.github.com> Signed-off-by: Craig <CraigUkaea@gmail.com>
Implements #349.
Interface types can now be piped directly into show, like this:
$ ros2 topic type /chatter | ros2 interface show