From f690c35883dd895a3371402da750667b10d6536c Mon Sep 17 00:00:00 2001 From: darosior Date: Mon, 14 Oct 2019 22:52:58 +0200 Subject: [PATCH] cleanup lightning-pay No json.dumps, make bolt11 a required argument (better usage output instead of assertion error) --- contrib/pylightning/lightning-pay | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/contrib/pylightning/lightning-pay b/contrib/pylightning/lightning-pay index 400fd3120..d7aa11170 100755 --- a/contrib/pylightning/lightning-pay +++ b/contrib/pylightning/lightning-pay @@ -2,12 +2,12 @@ import argparse import os +import pprint import sys -import json from lightning import LightningRpc parser = argparse.ArgumentParser(formatter_class=argparse.ArgumentDefaultsHelpFormatter) -parser.add_argument("bolt11_or_destination_id") +parser.add_argument("bolt11_or_destination_id", required=True) parser.add_argument("amount_in_milli_satoshi", default=None, type=int, nargs="?") parser.add_argument("payment_hash", nargs="?") parser.add_argument("min_final_cltv_expiry", nargs="?") @@ -31,7 +31,8 @@ use_bolt11 = args.bolt11_or_destination_id[:2] == "ln" if use_bolt11: bolt11 = ld.decodepay(args.bolt11_or_destination_id) - print("Bolt11 decoded:\n%s" % json.dumps(bolt11, indent=4)) + print("Bolt11 decoded:") + pprint.pprint(bolt11) id_ = bolt11["payee"] payment_hash = bolt11["payment_hash"] if "msatoshi" in bolt11: