-
Notifications
You must be signed in to change notification settings - Fork 55
Closed
Description
$ warnet bitcoin rpc tank-0000 getnetmsgstats '["network"]'
error: Error parsing JSON: [network]
command terminated with exit code 1
We could be smarter how we parse these arguments so users don't have to escape all the quotes. I've also notice that spaces in JSON ( '["network", "message_type"]'
) can get interpreted as separate arguments and fail. Maybe we should try to detect JSON in the entire rpc string before chopping it up:
Lines 23 to 37 in 4367c7c
@bitcoin.command(context_settings={"ignore_unknown_options": True}) | |
@click.argument("tank", type=str) | |
@click.argument("method", type=str) | |
@click.argument("params", type=str, nargs=-1) # this will capture all remaining arguments | |
@click.option("--namespace", default=None, show_default=True) | |
def rpc(tank: str, method: str, params: str, namespace: Optional[str]): | |
""" | |
Call bitcoin-cli <method> [params] on <tank pod name> | |
""" | |
try: | |
result = _rpc(tank, method, params, namespace) | |
except Exception as e: | |
print(f"{e}") | |
sys.exit(1) |
sr-gi
Metadata
Metadata
Assignees
Labels
No labels