Browse Source

Modify optparse description format for wallet-tool.

Before this commit, the help message for wallet-tool was
very hard to read; this improves the format of the message
by overriding optparse's default handling of description
paragraphs, making it pass through the string exactly as is,
and also reformatting the string itself.
master
Adam Gibson 5 years ago
parent
commit
dee40dbc24
No known key found for this signature in database
GPG Key ID: 141001A1AF77F20B
  1. 53
      jmclient/jmclient/wallet_utils.py

53
jmclient/jmclient/wallet_utils.py

@ -5,7 +5,7 @@ import sqlite3
import binascii import binascii
from datetime import datetime from datetime import datetime
from calendar import timegm from calendar import timegm
from optparse import OptionParser from optparse import OptionParser, IndentedHelpFormatter
from numbers import Integral from numbers import Integral
from collections import Counter from collections import Counter
from itertools import islice from itertools import islice
@ -29,29 +29,36 @@ DEFAULT_MIXDEPTH = 4
def get_wallettool_parser(): def get_wallettool_parser():
description = (
'Use this script to monitor and manage your Joinmarket wallet.\n' # optparse munges description paragraphs. Here we
'The method is one of the following: \n' # have a big, complex paragraph which we need to control:
'(display) Shows addresses and balances.\n' class IndentedHelpFormatterWithNL(IndentedHelpFormatter):
'(displayall) Shows ALL addresses and balances.\n' def format_description(self, description):
'(summary) Shows a summary of mixing depth balances.\n' return description
'(generate) Generates a new wallet.\n'
'(changepass) Changes the encryption passphrase of the wallet.\n' description ="""Use this script to monitor and manage your Joinmarket wallet.
'(history) Show all historical transaction details. Requires Bitcoin Core.' The method is one of the following:
'(recover) Recovers a wallet from the 12 word recovery seed.\n' (display) Shows addresses and balances.
'(showutxos) Shows all utxos in the wallet.\n' (displayall) Shows ALL addresses and balances.
'(showseed) Shows the wallet recovery seed and hex seed.\n' (summary) Shows a summary of mixing depth balances.
'(importprivkey) Adds privkeys to this wallet, privkeys are spaces or commas separated.\n' (generate) Generates a new wallet.
'(dumpprivkey) Export a single private key, specify an hd wallet path\n' (changepass) Changes the encryption passphrase of the wallet.
'(signmessage) Sign a message with the private key from an address in \n' (history) Show all historical transaction details. Requires Bitcoin Core.
'the wallet. Use with -H and specify an HD wallet path for the address.\n' (recover) Recovers a wallet from the 12 word recovery seed.
'(freeze) Freeze or un-freeze a specific utxo. Specify mixdepth with -m.\n' (showutxos) Shows all utxos in the wallet.
'(gettimelockaddress) Obtain a timelocked address. Argument is locktime value as yyyy-mm. For example `2021-03`\n' (showseed) Shows the wallet recovery seed and hex seed.
'(addtxoutproof) Add a tx out proof as metadata to a burner transaction. Specify path with ' (importprivkey) Adds privkeys to this wallet, privkeys are spaces or commas separated.
'-H and proof which is output of Bitcoin Core\'s RPC call gettxoutproof\n' (dumpprivkey) Export a single private key, specify an hd wallet path.
'(createwatchonly) Create a watch-only fidelity bond wallet') (signmessage) Sign a message with the private key from an address in
the wallet. Use with -H and specify an HD wallet path for the address.
(freeze) Freeze or un-freeze a specific utxo. Specify mixdepth with -m.
(gettimelockaddress) Obtain a timelocked address. Argument is locktime value as yyyy-mm. For example `2021-03`.
(addtxoutproof) Add a tx out proof as metadata to a burner transaction. Specify path with
-H and proof which is output of Bitcoin Core\'s RPC call gettxoutproof.
(createwatchonly) Create a watch-only fidelity bond wallet.
"""
parser = OptionParser(usage='usage: %prog [options] [wallet file] [method] [args..]', parser = OptionParser(usage='usage: %prog [options] [wallet file] [method] [args..]',
description=description) description=description, formatter=IndentedHelpFormatterWithNL())
add_base_options(parser) add_base_options(parser)
parser.add_option('-p', parser.add_option('-p',
'--privkey', '--privkey',

Loading…
Cancel
Save