{"id":13739849,"url":"https://github.com/bojand/gcall","last_synced_at":"2025-03-25T02:31:08.969Z","repository":{"id":57159611,"uuid":"78493723","full_name":"bojand/gcall","owner":"bojand","description":"Simple gRPC command line interface","archived":false,"fork":false,"pushed_at":"2018-09-09T23:01:46.000Z","size":80,"stargazers_count":12,"open_issues_count":1,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-19T07:01:54.309Z","etag":null,"topics":["grpc"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bojand.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-01-10T03:24:43.000Z","updated_at":"2023-04-18T21:27:32.000Z","dependencies_parsed_at":"2022-09-08T13:32:09.252Z","dependency_job_id":null,"html_url":"https://github.com/bojand/gcall","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bojand%2Fgcall","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bojand%2Fgcall/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bojand%2Fgcall/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bojand%2Fgcall/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bojand","download_url":"https://codeload.github.com/bojand/gcall/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245385331,"owners_count":20606648,"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":["grpc"],"created_at":"2024-08-03T04:00:38.319Z","updated_at":"2025-03-25T02:31:08.657Z","avatar_url":"https://github.com/bojand.png","language":"JavaScript","funding_links":[],"categories":["Tools"],"sub_categories":["CLI"],"readme":"# gcall\n\nSimple gRPC command-line interface\n\n[![npm version](https://img.shields.io/npm/v/gcall.svg?style=flat-square)](https://www.npmjs.com/package/gcall)\n[![build status](https://img.shields.io/travis/bojand/gcall/master.svg?style=flat-square)](https://travis-ci.org/bojand/gcall)\n\n## Installation\n\n```\n$ npm install -g gcall\n```\n\n## Usage\n\n```\nUsage: gcall [options] [rpc]\n\n  Options:\n\n    -h, --help                  output usage information\n    -V, --version               output the version number\n    -p, --proto \u003cfile\u003e          Path to protocol buffer definition.\n    -h, --host \u003chost\u003e           The service host.\n    -d, --data \u003cdata\u003e           Input data, otherwise standard input.\n    -o, --output \u003cfile\u003e         Output path, otherwise standard output.\n    -m, --metadata \u003cdata\u003e       Metadata value.\n    -s, --secure                Use secure options.\n    -S, --service \u003cname\u003e        Service name. Default is the 0th found in definition.\n    -j, --json [jsonpath]       Input is JSON. JSONPath for parsing. Default: '*'. Set to empty to turn off JSON parsing.\n    -b, --breaker [characters]  Separator character(s) for JSON stream response. If flag set, but no separator is defined, default newline is used as separator.\n    -a, --array                 Output response stream as an array. Default: false.\n    -r, --rpc \u003cname\u003e            RPC to call.\n    -c, --config \u003cfile\u003e         YAML or JSON config file with all the options.\n    -C, --color                 Color output. Useful for terminal output.\n    -P, --pretty                Pretty print output.\n    -R, --raw                   Raw output. Do not try to JSON stringify or do anything.\n    -E, --encoding [encoding]   Encoding for raw mode file output. Default: utf8.\n    -X, --silent                Silent. Do not output anything. Just do the call.\n```\n\n## Features\n\n* Works with all call types\n* Takes input from standard input allowing for piping or using `-d` data CLI argument\n* Metadata options\n* Config file option\n* Various output formatting options\n\n## Examples\n\n### Basic\n\nList all available RPC's in a service\n\n```sh\n$ gcall -p ./protos/route_guide.proto\n› GetFeature (Point) returns (Feature)\n› ListFeatures (Rectangle) returns (stream Feature)\n› RecordRoute (stream Point) returns (RouteSummary)\n› RouteChat (stream RouteNote) returns (stream RouteNote)\n```\n\n### Request / Response\n\nSimple request / response caller\n\n```sh\n$ gcall \\\n-p ./protos/route_guide.proto \\\n-d \"{\\\"latitude\\\":409146138,\\\"longitude\\\":-746188906}\" \\\n-h 0.0.0.0:50051 \\\nGetFeature\n{\"name\":\"Berkshire Valley Management Area Trail, Jefferson, NJ, USA\",\"location\":{\"latitude\":409146138,\"longitude\":-746188906}}\n```\n\nOutput data to a file\n\n```sh\n$ gcall \\\n-p ./protos/route_guide.proto \\\n-d \"{\\\"latitude\\\":409146138,\\\"longitude\\\":-746188906}\" \\\n-h 0.0.0.0:50051 \\\n-o ./feature.json \\\nGetFeature\n```\n\nInput by piping\n\n```sh\ncat ./data.json | gcall \\\n-p ./protos/route_guide.proto \\\n-h 0.0.0.0:50051 \\\nGetFeature\n```\n\nAdd metadata using `-m` option\n\n```sh\n$ gcall \\\n-p ./protos/route_guide.proto \\\n-m \"{\\\"Authorization\\\": \\\"Bearer 1234\\\"}\" \\\n-d \"{\\\"latitude\\\":409146138,\\\"longitude\\\":-746188906}\" \\\n-h 0.0.0.0:50051 \\\nGetFeature\n```\n\nPretty print with `-P` option:\n\n```sh\n$ gcall \\\n-p ./protos/route_guide.proto \\\n-d \"{\\\"latitude\\\":409146138,\\\"longitude\\\":-746188906}\" \\\n-h 0.0.0.0:50051 \\\n-P \\\nGetFeature\n{\n  \"name\": \"Berkshire Valley Management Area Trail, Jefferson, NJ, USA\",\n  \"location\": {\n    \"latitude\": 409146138,\n    \"longitude\": -746188906\n  }\n}\n```\n\nInspect using colors with `-C` option:\n\n```sh\n$ gcall \\\n-p ./protos/route_guide.proto \\\n-d \"{\\\"latitude\\\":409146138,\\\"longitude\\\":-746188906}\" \\\n-h 0.0.0.0:50051 \\\n-C \\\nGetFeature\n{ name: 'Berkshire Valley Management Area Trail, Jefferson, NJ, USA',\n location: { latitude: 409146138, longitude: -746188906 } }\n```\n\n### Request stream\n\n`-j` flag can be used to specify [JSONPath](http://goessner.net/articles/JsonPath/)\nfor JSON parsing. Default is `'*'` and normally it wouldn't be needed, depending on the\ninput data structure.\n\nInput redirection can be used for input as well.\n\n```sh\n$ gcall.js \\\n-p ./protos/route_guide.proto \\\n-h 0.0.0.0:50051 \\\n-j *.location \\\nRecordRoute \u003c ./feature_guide_db.json\n{\"point_count\":100,\"feature_count\":64,\"distance\":7494392,\"elapsed_time\":0}\n```\n\nWe can pipe\n\n```sh\ncurl -s https://raw.githubusercontent.com/bojand/gcall/master/test/data/feature_guide_db.json | gcall.js \\\n-p ./protos/route_guide.proto \\\n-h 0.0.0.0:50051 \\\n-j *.location \\\n-P \\\nRecordRoute\n{\n  \"point_count\": 100,\n  \"feature_count\": 64,\n  \"distance\": 7494392,\n  \"elapsed_time\": 4\n}\n```\n\n### Response stream\n\n```sh\n$ gcall.js \\\n-p ./protos/route_guide.proto \\\n-d \"{\\\"lo\\\":{\\\"latitude\\\":400000000,\\\"longitude\\\":-750000000},\\\"hi\\\":{\\\"latitude\\\":405000000,\\\"longitude\\\":-742000000}}\" \\\n-h 0.0.0.0:50051 \\\nListFeatures\n{\"name\":\"3 Drake Lane, Pennington, NJ 08534, USA\",\"location\":{\"latitude\":402948455,\"longitude\":-747903913}},{\"name\":\"330 Evelyn Avenue, Hamilton Township, NJ 08619, USA\",\"location\":{\"latitude\":402647019,\"longitude\":-747071791}},{\"name\":\"1300 Airport Road, North Brunswick Township, NJ 08902, USA\",\"location\":{\"latitude\":404663628,\"longitude\":-744820157}},{\"name\":\"1007 Jersey Avenue, New Brunswick, NJ 08901, USA\",\"location\":{\"latitude\":404701380,\"longitude\":-744781745}},{\"name\":\"517-521 Huntington Drive, Manchester Township, NJ 08759, USA\",\"location\":{\"latitude\":400106455,\"longitude\":-742870190}},{\"name\":\"1-17 Bergen Court, New Brunswick, NJ 08901, USA\",\"location\":{\"latitude\":404839914,\"longitude\":-744759616}}\n```\n\nWe can pretty print as an array using `-a` and `-P` options:\n\n```sh\n$ gcall.js \\\n-p ./protos/route_guide.proto \\\n-d \"{\\\"lo\\\":{\\\"latitude\\\":400000000,\\\"longitude\\\":-750000000},\\\"hi\\\":{\\\"latitude\\\":405000000,\\\"longitude\\\":-742000000}}\" \\\n-h 0.0.0.0:50051 \\\n-a \\\n-P \\\nListFeatures\n[\n  {\n    \"name\": \"3 Drake Lane, Pennington, NJ 08534, USA\",\n    \"location\": {\n      \"latitude\": 402948455,\n      \"longitude\": -747903913\n    }\n  },\n  {\n    \"name\": \"330 Evelyn Avenue, Hamilton Township, NJ 08619, USA\",\n    \"location\": {\n      \"latitude\": 402647019,\n      \"longitude\": -747071791\n    }\n  },\n  {\n    \"name\": \"1300 Airport Road, North Brunswick Township, NJ 08902, USA\",\n    \"location\": {\n      \"latitude\": 404663628,\n      \"longitude\": -744820157\n    }\n  },\n  {\n    \"name\": \"1007 Jersey Avenue, New Brunswick, NJ 08901, USA\",\n    \"location\": {\n      \"latitude\": 404701380,\n      \"longitude\": -744781745\n    }\n  },\n  {\n    \"name\": \"517-521 Huntington Drive, Manchester Township, NJ 08759, USA\",\n    \"location\": {\n      \"latitude\": 400106455,\n      \"longitude\": -742870190\n    }\n  },\n  {\n    \"name\": \"1-17 Bergen Court, New Brunswick, NJ 08901, USA\",\n    \"location\": {\n      \"latitude\": 404839914,\n      \"longitude\": -744759616\n    }\n  }\n]\n```\n\nOr we can do a custom separator using `-b`. If separator is not provided, newline\nis used by default\n\n```sh\n$ gcall.js \\\n-p ./protos/route_guide.proto \\\n-d \"{\\\"lo\\\":{\\\"latitude\\\":400000000,\\\"longitude\\\":-750000000},\\\"hi\\\":{\\\"latitude\\\":405000000,\\\"longitude\\\":-742000000}}\" \\\n-b \\\n-h 0.0.0.0:50051 \\\nListFeatures\n{\"name\":\"3 Drake Lane, Pennington, NJ 08534, USA\",\"location\":{\"latitude\":402948455,\"longitude\":-747903913}}\n{\"name\":\"330 Evelyn Avenue, Hamilton Township, NJ 08619, USA\",\"location\":{\"latitude\":402647019,\"longitude\":-747071791}}\n{\"name\":\"1300 Airport Road, North Brunswick Township, NJ 08902, USA\",\"location\":{\"latitude\":404663628,\"longitude\":-744820157}}\n{\"name\":\"1007 Jersey Avenue, New Brunswick, NJ 08901, USA\",\"location\":{\"latitude\":404701380,\"longitude\":-744781745}}\n{\"name\":\"517-521 Huntington Drive, Manchester Township, NJ 08759, USA\",\"location\":{\"latitude\":400106455,\"longitude\":-742870190}}\n{\"name\":\"1-17 Bergen Court, New Brunswick, NJ 08901, USA\",\"location\":{\"latitude\":404839914,\"longitude\":-744759616}}\n```\n\nOr with combination of `-b` and `-a`\n\n```sh\n$ gcall.js \\\n-p ./protos/route_guide.proto \\\n-d \"{\\\"lo\\\":{\\\"latitude\\\":400000000,\\\"longitude\\\":-750000000},\\\"hi\\\":{\\\"latitude\\\":405000000,\\\"longitude\\\":-742000000}}\" \\\n-b \\\n-a \\\n-h 0.0.0.0:50051 \\\nListFeatures\n{\"name\":\"3 Drake Lane, Pennington, NJ 08534, USA\",\"location\":{\"latitude\":402948455,\"longitude\":-747903913}}\n,\n{\"name\":\"330 Evelyn Avenue, Hamilton Township, NJ 08619, USA\",\"location\":{\"latitude\":402647019,\"longitude\":-747071791}}\n,\n{\"name\":\"1300 Airport Road, North Brunswick Township, NJ 08902, USA\",\"location\":{\"latitude\":404663628,\"longitude\":-744820157}}\n,\n{\"name\":\"1007 Jersey Avenue, New Brunswick, NJ 08901, USA\",\"location\":{\"latitude\":404701380,\"longitude\":-744781745}}\n,\n{\"name\":\"517-521 Huntington Drive, Manchester Township, NJ 08759, USA\",\"location\":{\"latitude\":400106455,\"longitude\":-742870190}}\n,\n{\"name\":\"1-17 Bergen Court, New Brunswick, NJ 08901, USA\",\"location\":{\"latitude\":404839914,\"longitude\":-744759616}}]\n```\n\nOr just a custom separator\n\n```sh\n$ gcall.js \\\n-p ./protos/route_guide.proto \\\n-d \"{\\\"lo\\\":{\\\"latitude\\\":400000000,\\\"longitude\\\":-750000000},\\\"hi\\\":{\\\"latitude\\\":405000000,\\\"longitude\\\":-742000000}}\" \\\n-b \" | \" \\\n-h 0.0.0.0:50051 \\\nListFeatures\n{\"name\":\"3 Drake Lane, Pennington, NJ 08534, USA\",\"location\":{\"latitude\":402948455,\"longitude\":-747903913}} | {\"name\":\"330 Evelyn Avenue, Hamilton Township, NJ 08619, USA\",\"location\":{\"latitude\":402647019,\"longitude\":-747071791}} | {\"name\":\"1300 Airport Road, North Brunswick Township, NJ 08902, USA\",\"location\":{\"latitude\":404663628,\"longitude\":-744820157}} | {\"name\":\"1007 Jersey Avenue, New Brunswick, NJ 08901, USA\",\"location\":{\"latitude\":404701380,\"longitude\":-744781745}} | {\"name\":\"517-521 Huntington Drive, Manchester Township, NJ 08759, USA\",\"location\":{\"latitude\":400106455,\"longitude\":-742870190}} | {\"name\":\"1-17 Bergen Court, New Brunswick, NJ 08901, USA\",\"location\":{\"latitude\":404839914,\"longitude\":-744759616}}\n```\n\n### Duplex\n\n```sh\n./gcall.js \\\n-p ./protos/route_guide.proto \\\n-h 0.0.0.0:50051 \\\nRouteChat \u003c ./notes.json\n{\"location\":{\"latitude\":0,\"longitude\":0},\"message\":\"First message\"}\n```\n\n```sh\n./gcall.js \\\n-p ./protos/route_guide.proto \\\n-h 0.0.0.0:50051 \\\n-a \\\n-P \\\nRouteChat \u003c ./notes.json\n[\n  {\n    \"location\": {\n      \"latitude\": 0,\n      \"longitude\": 0\n    },\n    \"message\": \"First message\"\n  },\n  {\n    \"location\": {\n      \"latitude\": 0,\n      \"longitude\": 0\n    },\n    \"message\": \"Fourth message\"\n  },\n  {\n    \"location\": {\n      \"latitude\": 0,\n      \"longitude\": 1\n    },\n    \"message\": \"Second message\"\n  },\n  {\n    \"location\": {\n      \"latitude\": 1,\n      \"longitude\": 0\n    },\n    \"message\": \"Third message\"\n  }\n]\n```\n\n### Config\n\nWe can run `gcall` using a config file in either JSON or YAML format.\nNote that you can combine config file and command line options.\nCommand line options will overwrite any existing config file options.\n\n**config.json**\n\n```json\n{\n  \"proto\": \"/protos/route_guide.proto\",\n  \"data\": {\n    \"latitude\": 409146138,\n    \"longitude\": -746188906\n  },\n  \"host\": \"0.0.0.0:50051\",\n  \"pretty\": true,\n  \"rpc\": \"GetFeature\"\n}\n```\n\n```sh\n$ gcall -c config.json\n{\n  \"name\": \"Berkshire Valley Management Area Trail, Jefferson, NJ, USA\",\n  \"location\": {\n    \"latitude\": 409146138,\n    \"longitude\": -746188906\n  }\n}\n```\n\n## License\n\n  Apache-2.0\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbojand%2Fgcall","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbojand%2Fgcall","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbojand%2Fgcall/lists"}