-
Notifications
You must be signed in to change notification settings - Fork 0
/
README
61 lines (43 loc) · 1.77 KB
/
README
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
jsonrpc-cli
========
A jsonrpc command line utility for devlopment and testing.
Usage
--------
jsonrpc-cli --endpoint <endpoint> [options] <method> [<params>]
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 <version> jsonrpc version, default: 2.0
-e, --endpoint <endpoint> jsonrpc server endpoint
-i, --id <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 <https://github.com/pluveto/jsonrpc-cli/releases>. 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.