mirror of
https://github.com/ElementsProject/lightning.git
synced 2024-11-19 01:43:36 +01:00
script: Auto generate rpc examples for documentation
I will commit doc/schemas/lightning-*.json files separately to keep this commit easier to review. - test-autogenerate-rpc-examples updates all example request & responses in doc/schemas/lightning-*.json files. - Updated tools/fromschema.py to accommodate the sql JSON example requirement where it does not accept -o in the query but shell does (for queries containing the = sign). Changelog-None.
This commit is contained in:
parent
fe7981bda2
commit
50faa7c122
1
.gitignore
vendored
1
.gitignore
vendored
@ -92,3 +92,4 @@ release/
|
||||
# Ignore release verification Sha256Sums
|
||||
SHA256SUMS-*
|
||||
doc/.doc_version
|
||||
autogenerate-examples-status.log
|
||||
|
1204
tests/autogenerate-rpc-examples.py
Normal file
1204
tests/autogenerate-rpc-examples.py
Normal file
File diff suppressed because it is too large
Load Diff
@ -297,6 +297,11 @@ def create_shell_command(rpc, example):
|
||||
shell_command = f'lightning-cli {rpc} '
|
||||
if 'params' in example['request']:
|
||||
if isinstance(example['request']['params'], list):
|
||||
if rpc == 'sql' and example['request']['params'] and '=' in example['request']['params'][0]:
|
||||
# For SQL queries in shell, prepend '-o' flag to the query
|
||||
query = example['request']['params'][0]
|
||||
shell_command += f"-o '{query}'" if "'" not in query else f'-o "{query}"'
|
||||
else:
|
||||
shell_command += ' '.join(f'"{item}"' for item in example['request']['params'])
|
||||
elif example['request']['params'].items():
|
||||
shell_command += '-k '
|
||||
|
Loading…
Reference in New Issue
Block a user