Skip to content
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

gz service -r should not require specifying a dummy message if the request type is Empty #474

Closed
azeey opened this issue Jan 26, 2024 · 4 comments
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed

Comments

@azeey
Copy link
Contributor

azeey commented Jan 26, 2024

Desired behavior

Currently, gz service -r requires specifying unused: true on requests with an Empty request type. This is not well documented and seems unintuitive. It would be great if the user is able to provide an empty message (gz service -r ' ' ...) or no value at all (gz service -r ...).

Together with #473, it would be nice to be able to run

gz service -s /gazebo/worlds -r --timeout 2000

instead of

gz service -s /gazebo/worlds --reqtype gz.msgs.Empty --reptype gz.msgs.StringMsg_V -r 'unused: true' --timeout 2000

Alternatives considered

n/a

Implementation suggestion

Handle the case where reqtype is Empty so that an empty message is considered valid.

Additional context

n/a

@azeey azeey added enhancement New feature or request help wanted Extra attention is needed labels Jan 26, 2024
@azeey azeey added the good first issue Good for newcomers label Jan 26, 2024
@mjcarroll mjcarroll moved this from Inbox to To do in Core development Jan 30, 2024
@caguero
Copy link
Collaborator

caguero commented Mar 21, 2024

@azeey , What do you think about allowing -r ""? The option -r is configured as a parameter that accepts a value. Not sure if we can make the value optional.

@mjcarroll
Copy link
Contributor

I believe you can add ->expected(0,1) to make it take 0 or 1 arguments

@azeey
Copy link
Contributor Author

azeey commented Mar 21, 2024

I'm okay with -r "", but if @mjcarroll's suggestion works, that would be even better.

@caguero
Copy link
Collaborator

caguero commented Mar 21, 2024

I believe you can add ->expected(0,1) to make it take 0 or 1 arguments

Thanks, it works!

@azeey azeey closed this as completed May 31, 2024
@github-project-automation github-project-automation bot moved this from To do to Done in Core development May 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed
Projects
Archived in project
Development

No branches or pull requests

3 participants