[ANN] grpcget - Customizable command line client for gRPC, also a reusable library

46 views
Skip to first unread message

Rangel Reale

unread,
Apr 23, 2018, 7:59:51 AM4/23/18
to grpc.io
grpcget is a command-line client for gRPC servers with reflection enabled.

https://github.com/RangelReale/grpcget

With this tool you can query the server for services and symbols, and invoke methods with parameters.

The parameters for a method invocation are simple name=value parameters, and the name can have "." to set values in inner messages.

The default implementation output is aimed to be user-friendly, not JSON or marchine parseable. But using output customizers it is easy to create a version that does output other formats.

grpcget is also a customizable library that you can use in your projects.

It supports customizing setters and getters so you can define special handling for types that your application supports.

Example:

# grpcget -plaintext invoke localhost:50051 helloworld.Greeter.SayHello name="Han Solo"
message: Hello Han Solo

This library is heavily based on grpccurl, and the packages it uses.

Thanks,
Rangel Reale

Jan Tattermusch

unread,
Apr 24, 2018, 3:35:55 AM4/24/18
to Rangel Reale, grpc.io
Hi Rangel,
thanks for sharing!

How does your tool compare to the grpc_cli (which is part of gRPC) in terms of features? What are the key differences, pros and cons?

Jan

--
You received this message because you are subscribed to the Google Groups "grpc.io" group.
To unsubscribe from this group and stop receiving emails from it, send an email to grpc-io+unsubscribe@googlegroups.com.
To post to this group, send email to grp...@googlegroups.com.
Visit this group at https://groups.google.com/group/grpc-io.
To view this discussion on the web visit https://groups.google.com/d/msgid/grpc-io/ea4af446-5efe-409c-a4d6-8cb93098dee9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--

Jan

Rangel Reale

unread,
Apr 24, 2018, 8:24:39 AM4/24/18
to grpc.io
Hello,

the main motivation for a new tool was to make a cli for the end user, in my opinion the existing tools are somewhat geared to be used by tools, with hard-to-use parameter input and output.

For example with a (convoluted) request like this, the parameters are easy to enter on the command line, and would be very hard to do with the grpc_cli text format, or json:

service SM {
  rpc SendSM(SMData) returns (SMData);
}

message SMData {
    string data = 1;
    string data2 = 2;
    map<string, SMData> data_list = 3;
    repeated SMData data_repeat = 4;
}

# grpcget invoke localhost:50051 SM.SendSM data="Value" 
data_list.item1.data="Value inside the map with key 'item'" 
data_list.item1.data2="Value inside the same map as the previous param" 
data_repeat.0.data="Value inside the repeat with index '0'"
data_repeat.0.data2="Value into the same index '0' as the previous"
data_repeat.1.data2="Value inside the repeat with index '1'"

The other motivation was to allow intput and output customization, like showing google.protobuf.* types as the real underlining type, and custom application types like UUID to be passed as a single value instead as an internal "user_id.value".

Things that are missing for now are supporting servers without reflection, stream support, and even other intput/output formats like JSON.

Another objective of this was to create an embeddable library that I can use to create a cli for my own service, which for example allows me to abbreviate service names when calling, supporting application specific types and authentication, etc.

gprc_cli also have a problem of documentation, I had to search a lot to find out how to set the parameters on the command line.

Regards,
Rangel

On Tuesday, 24 April 2018 04:35:55 UTC-3, Jan Tattermusch wrote:
Hi Rangel,
thanks for sharing!

How does your tool compare to the grpc_cli (which is part of gRPC) in terms of features? What are the key differences, pros and cons?

Jan
On Mon, Apr 23, 2018 at 1:59 PM, Rangel Reale <range...@gmail.com> wrote:
grpcget is a command-line client for gRPC servers with reflection enabled.

https://github.com/RangelReale/grpcget

With this tool you can query the server for services and symbols, and invoke methods with parameters.

The parameters for a method invocation are simple name=value parameters, and the name can have "." to set values in inner messages.

The default implementation output is aimed to be user-friendly, not JSON or marchine parseable. But using output customizers it is easy to create a version that does output other formats.

grpcget is also a customizable library that you can use in your projects.

It supports customizing setters and getters so you can define special handling for types that your application supports.

Example:

# grpcget -plaintext invoke localhost:50051 helloworld.Greeter.SayHello name="Han Solo"
message: Hello Han Solo

This library is heavily based on grpccurl, and the packages it uses.

Thanks,
Rangel Reale

--
You received this message because you are subscribed to the Google Groups "grpc.io" group.
To unsubscribe from this group and stop receiving emails from it, send an email to grpc-io+u...@googlegroups.com.

To post to this group, send email to grp...@googlegroups.com.
Visit this group at https://groups.google.com/group/grpc-io.
To view this discussion on the web visit https://groups.google.com/d/msgid/grpc-io/ea4af446-5efe-409c-a4d6-8cb93098dee9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--

Jan

Reply all
Reply to author
Forward
0 new messages