cli: add -c/--commando support.

It's easier to type:

```
lightning-cli --commando=03ce2d830369fc903ffec52ca1d7aba095c3cf5d17175b6c9a3ff058f6aece37bc:V08OylkJ2ZZPClAXbTaxrXJ9YpKnmucJxcQI-wvIGiE9MA== invoice any "Invoice Label" "Invoice Description"
lightning-cli --commando=03ce2d830369fc903ffec52ca1d7aba095c3cf5d17175b6c9a3ff058f6aece37bc:V08OylkJ2ZZPClAXbTaxrXJ9YpKnmucJxcQI-wvIGiE9MA== commando amount_msat=100000 label="invoice label" description="invoice description"
```

Than:

```
commando 03ce2d830369fc903ffec52ca1d7aba095c3cf5d17175b6c9a3ff058f6aece37bc invoice '["any", "Invoice Label", "Invoice Description"]' V08OylkJ2ZZPClAXbTaxrXJ9YpKnmucJxcQI-wvIGiE9MA==
commando 03ce2d830369fc903ffec52ca1d7aba095c3cf5d17175b6c9a3ff058f6aece37bc invoice '{"amount_msat": "100000", "label": "invoice label", "description": "invoice description"}' V08OylkJ2ZZPClAXbTaxrXJ9YpKnmucJxcQI-wvIGiE9MA==
```

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Changelog-Added: cli: `--commando=peerid:rune` (or `-c peerid:rune`) as convenient shortcut for running commando commands.
This commit is contained in:
Rusty Russell
2023-01-03 14:53:28 +10:30
parent 3f0c5b985b
commit 404e961bad
3 changed files with 183 additions and 6 deletions

View File

@@ -69,7 +69,7 @@ field without parsing JSON.
If *LEVEL* is 'none', then never print out notifications. Otherwise,
print out notifications of *LEVEL* or above (one of `io`, `debug`,
`info` (the default), `unusual` or `broken`: they are prefixed with `#
`.
`. (Note: currently not supported with `--commando`).
* **--filter**/**-l**=*JSON*
@@ -84,12 +84,21 @@ be changed using `-F`, `-R`, `-J`, `-H` etc.
Print version number to standard output and exit.
* **allow-deprecated-apis**=*BOOL*
* **--allow-deprecated-apis**=*BOOL*
Enable deprecated options. It defaults to *true*, but you should set
it to *false* when testing to ensure that an upgrade won't break your
configuration.
* **--commando**/**-c**=**peerid**:**rune**
Convenience option to indicate that this command should be wrapped
in a `commando` command to be sent to the connected peer with id
`peerid`, using rune `rune`. This also means that any `--filter` is
handed via commando to the remote peer to reduce its output (which it
will do it it is v23.02 or newer), rather than trying to do so
locally. Note that currently `-N` is not supported by commando.
COMMANDS
--------