mirror of
https://github.com/bitcoin/bitcoin.git
synced 2024-11-19 18:09:47 +01:00
d8b12a75db
It's nice to be able to use named options and positional arguments together. Most shell tools accept both, and python functions combine options and arguments allowing them to be passed with even more flexibility. This change adds support for python's approach so as a motivating example: bitcoin-cli -named createwallet wallet_name=mywallet load_on_startup=1 Can be shortened to: bitcoin-cli -named createwallet mywallet load_on_startup=1 JSON-RPC standard doesn't have a convention for passing named and positional parameters together, so this implementation makes one up and interprets any unused "args" named parameter as a positional parameter array.
20 lines
549 B
Markdown
20 lines
549 B
Markdown
JSON-RPC
|
|
---
|
|
|
|
All JSON-RPC methods accept a new [named
|
|
parameter](JSON-RPC-interface.md#parameter-passing) called `args` that can
|
|
contain positional parameter values. This is a convenience to allow some
|
|
parameter values to be passed by name without having to name every value. The
|
|
python test framework and `bitcoin-cli` tool both take advantage of this, so
|
|
for example:
|
|
|
|
```sh
|
|
bitcoin-cli -named createwallet wallet_name=mywallet load_on_startup=1
|
|
```
|
|
|
|
Can now be shortened to:
|
|
|
|
```sh
|
|
bitcoin-cli -named createwallet mywallet load_on_startup=1
|
|
```
|