{"id":17370142,"url":"https://github.com/nathanielc/grpccmd","last_synced_at":"2025-07-19T06:03:00.842Z","repository":{"id":57528109,"uuid":"84499637","full_name":"nathanielc/grpccmd","owner":"nathanielc","description":"gRPC Command line interface for any gRPC service in Go","archived":false,"fork":false,"pushed_at":"2019-09-12T12:10:57.000Z","size":13,"stargazers_count":17,"open_issues_count":1,"forks_count":4,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-04-15T03:44:12.119Z","etag":null,"topics":["cli","go","grpc"],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nathanielc.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-03-09T23:51:59.000Z","updated_at":"2021-09-11T08:31:31.000Z","dependencies_parsed_at":"2022-09-03T19:42:05.073Z","dependency_job_id":null,"html_url":"https://github.com/nathanielc/grpccmd","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/nathanielc/grpccmd","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nathanielc%2Fgrpccmd","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nathanielc%2Fgrpccmd/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nathanielc%2Fgrpccmd/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nathanielc%2Fgrpccmd/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nathanielc","download_url":"https://codeload.github.com/nathanielc/grpccmd/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nathanielc%2Fgrpccmd/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265895652,"owners_count":23845374,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cli","go","grpc"],"created_at":"2024-10-16T00:23:42.444Z","updated_at":"2025-07-19T06:03:00.642Z","avatar_url":"https://github.com/nathanielc.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# grpccmd\n\ngrpccmd is a CLI generator for any gRPC service in Go.\nWhile the CLI is written in Go the CLI should be able to talk to any gRPC server in any language.\nThe grpccmd is implemented as a plugin to protoc.\n\n## Install\n\nTo install the protoc plugin binary run:\n\n```\ngo get -u github.com/nathanielc/grpccmd/cmd/protoc-gen-grpccmd\n```\n\n## Example\n\nTo generate code for a CLI run this command.\n\n```\nprotoc path/to/file.proto --grpccmd_out=.\n```\n\nIt is recommended to place the above command as a Go generate comment in a main.go file.\n\nCreate a main.go file that references the generated code.\n\n```go\npackage main\n\nimport (\n\t\"fmt\"\n\t\"os\"\n\n\t\"github.com/nathanielc/grpccmd\"\n\t// Import grpccmd generated code\n\t_ \"github.com/nathanielc/grpccmd/example/internal/pb\"\n)\n\n//go:generate protoc -I ../internal/pb/ ../internal/pb/example.proto --grpccmd_out=../internal/pb/\n\nfunc main() {\n\tgrpccmd.SetCmdInfo(\n\t\t\"example-rpc\",\n\t\t\"Make calls to the Example service\",\n\t\t\"example-rpc command has been autogenerated via the protoc plugin github.com/nathanielc/grpccmd\",\n\t)\n\tif err := grpccmd.Execute(); err != nil {\n\t\tfmt.Println(err)\n\t\tos.Exit(-1)\n\t}\n}\n```\n\nThe above code is part of a working example in the `./example` directory from this project.\n\nTo try it out run:\n\n```\n# Start the server\ngo run ./example/server/main.go\n```\n\n```\n# Install the CLI\ngo install ./example/example-rpc\n# Make a few calls to the server\nexample-rpc --addr localhost:50051 example getNumber\nexample-rpc --addr localhost:50051 example echo --input '{\"str\":\"this is a string\", \"int\": 42, \"dbl\": 6.9, \"kv\" : {\"key\":\"value\"}}'\n```\n\n\n## Server Code\n\nThe grpccmd wraps the normal grpc protoc plugin so the generated code can be used by the server as well.\nWhether you do so is up to you as it is easy enough to generate the code twice, once for the server without grpccmd and once for the client with grpccmd.\nGenerating the code twice allows the client and server to be decoupled since they do not have to import the same package.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnathanielc%2Fgrpccmd","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnathanielc%2Fgrpccmd","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnathanielc%2Fgrpccmd/lists"}