Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/pluveto/jsonrpc-cli

A jsonrpc command line tool for devlopment and testing.
https://github.com/pluveto/jsonrpc-cli

Last synced: 4 days ago
JSON representation

A jsonrpc command line tool for devlopment and testing.

Awesome Lists containing this project

README

        

jsonrpc-cli
========

A jsonrpc command line utility for devlopment and testing.

Usage
--------

jsonrpc-cli --endpoint [options] []

Params can be the following formats:

1. JSON string, e.g. `{"a": 1, "b": 2}`
2. JSON file, e.g. `@/path/to/file.json`
3. Key-value pair
Examples
- `a=int(1) b=null()` generates `{"a": 1, "b": null}`
- `--a=1 --b=2` generates `{"a": "1", "b": "2"}`
- `-a 1 -b 2` generates `{"a": "1", "b": "2"}`
4. Array separated by comma, e.g. `1,2,3` generates `[1, 2, 3]`

Examples
--------

# call `add` method with params `{"a": 1, "b": 2}`
JSONRPC_ENDPOINT=http://localhost:3000 jsonrpc add 1 2
# alternatively
JSONRPC_ENDPOINT=http://localhost:3000 jsonrpc add 1,2

# call `vector_product` method with params `{"a": [1, 2, 3], "b": [4, 5, 6]}`
JSONRPC_ENDPOINT=http://localhost:3000 jsonrpc vector_product {"a": [1, 2, 3], "b": [4, 5, 6]}

Options
--------

-h, --help output usage information
-V, --version output the version number
-v, --rpc-version jsonrpc version, default: 2.0
-e, --endpoint jsonrpc server endpoint
-i, --id jsonrpc id, e.g. "test", "int(1)", "null()"
-d, --verbose verbose output for debugging

NOTE: `--endpoint` can be set by environment variable `JSONRPC_ENDPOINT`.

Build and Install
--------

Released binaries are available at . Or you can build it from source code:

git clone https://github.com/pluveto/jsonrpc-cli
cd jsonrpc-cli

Default PREFIX is `/usr/local`, you can change it by `make PREFIX=/path/to/prefix install`.

make
make install

License
--------

This program is licensed under the MIT license.