fix positional arguments

This commit is contained in:
ThomasV 2015-05-30 16:14:56 +02:00
parent 966bb3c15f
commit 2ab9272f52
1 changed files with 51 additions and 51 deletions

View File

@ -55,60 +55,60 @@ def register_command(*args):
# requires_password
# arguments
# options
register_command('listcontacts', 0, 0, 0, {}, [], 'Show your list of contacts', '')
register_command('create', 0, 1, 0, {}, [], 'Create a new wallet', '')
register_command('createmultisig', 0, 1, 0, {'num':'number','pubkeys':'pubkeys'}, [], 'Create multisig address', '')
register_command('createrawtx', 0, 1, 0, {'inputs':'', 'outputs':''}, [], 'Create an unsigned transaction.', 'The syntax is similar to bitcoind.')
register_command('deseed', 0, 1, 0, {}, [], 'Remove seed from wallet.', 'This creates a seedless, watching-only wallet.')
register_command('decoderawtx', 0, 0, 0, {'tx':'serialized transaction'}, [], 'Decode raw transaction.', '')
register_command('getprivatekeys', 0, 1, 1, {'address':'Bitcoin address'}, [], 'Get the private keys of a wallet address.', '')
register_command('dumpprivkeys', 0, 1, 1, {}, [], 'Dump private keys from your wallet', '')
register_command('freeze', 0, 1, 1, {'address':'Bitcoin address'}, [], 'Freeze address.', 'Freeze the funds at one of your wallet\'s addresses')
register_command('getbalance', 1, 1, 0, {}, [], 'Return the balance of your wallet', '')
register_command('getservers', 1, 0, 0, {}, [], 'Return the list of available servers', '')
register_command('getaddressbalance', 1, 0, 0, {'address':'Bitcoin address'}, [], 'Return the balance of an address', '')
register_command('getaddresshistory', 1, 0, 0, {'address':'Bitcoin address'}, [], 'Return the transaction history of a wallet address', '')
register_command('getconfig', 0, 0, 0, {'key':'Variable name'}, [], 'Return a configuration variable', '')
register_command('getpubkeys', 0, 1, 0, {'address':'Bitcoin address'}, [], 'Return the public keys for a wallet address', '')
register_command('getrawtx', 1, 0, 0, {'txid':'Transaction ID'}, [], 'Retrieve a transaction', '')
register_command('getseed', 0, 1, 1, {}, [], 'Get seed phrase', 'Print the generation seed of your wallet.')
register_command('getmpk', 0, 1, 0, {}, [], 'Get Master Public Key', 'Return your wallet\'s master public key')
register_command('help', 0, 0, 0, {}, [], 'Print help on a command.', '')
register_command('history', 1, 1, 0, {}, [], 'Wallet history', 'Returns the transaction history of your wallet')
register_command('importprivkey', 0, 1, 1, {'privkey':'Private key'}, [], 'Import a private key', '')
register_command('ismine', 0, 1, 0, {'address':'Bitcoin address'}, [], 'Check if address is in wallet', 'Return true if and only if address is in wallet')
register_command('listaddresses', 0, 1, 0, {}, ['show_all', 'show_labels'], 'List wallet addresses', 'Returns your list of addresses.')
register_command('listunspent', 1, 1, 0, {}, [], 'List unspent outputs', 'Returns the list of unspent transaction outputs in your wallet.')
register_command('getaddressunspent', 1, 0, 0, {'address':'Bitcoin address'}, [], 'Returns the list of unspent inputs for an address.', '')
register_command('mktx', 0, 1, 1, {'recipient':'Bitcoin address', 'amount':'Amount in BTC'},
register_command('listcontacts', 0, 0, 0, [], [], 'Show your list of contacts', '')
register_command('create', 0, 1, 0, [], [], 'Create a new wallet', '')
register_command('createmultisig', 0, 1, 0, [('num','number'), ('pubkeys', 'Public keys (json)')], [], 'Create multisig address', '')
register_command('createrawtx', 0, 1, 0, [('inputs', ''), ('outputs', '')], [], 'Create an unsigned transaction.', 'The syntax is similar to bitcoind.')
register_command('deseed', 0, 1, 0, [], [], 'Remove seed from wallet.', 'This creates a seedless, watching-only wallet.')
register_command('decoderawtx', 0, 0, 0, [('tx', 'Serialized transaction')], [], 'Decode raw transaction.', '')
register_command('getprivatekeys', 0, 1, 1, [('address', 'Bitcoin address')], [], 'Get the private keys of a wallet address.', '')
register_command('dumpprivkeys', 0, 1, 1, [], [], 'Dump private keys from your wallet', '')
register_command('freeze', 0, 1, 1, [('address', 'Bitcoin address')], [], 'Freeze address.', 'Freeze the funds at one of your wallet\'s addresses')
register_command('getbalance', 1, 1, 0, [], [], 'Return the balance of your wallet', '')
register_command('getservers', 1, 0, 0, [], [], 'Return the list of available servers', '')
register_command('getaddressbalance', 1, 0, 0, [('address', 'Bitcoin address')], [], 'Return the balance of an address', '')
register_command('getaddresshistory', 1, 0, 0, [('address', 'Bitcoin address')], [], 'Return the transaction history of a wallet address', '')
register_command('getconfig', 0, 0, 0, [('key', 'Variable name')], [], 'Return a configuration variable', '')
register_command('getpubkeys', 0, 1, 0, [('address', 'Bitcoin address')], [], 'Return the public keys for a wallet address', '')
register_command('getrawtx', 1, 0, 0, [('txid', 'Transaction ID')], [], 'Retrieve a transaction', '')
register_command('getseed', 0, 1, 1, [], [], 'Get seed phrase', 'Print the generation seed of your wallet.')
register_command('getmpk', 0, 1, 0, [], [], 'Get Master Public Key', 'Return your wallet\'s master public key')
register_command('help', 0, 0, 0, [], [], 'Print help on a command.', '')
register_command('history', 1, 1, 0, [], [], 'Wallet history', 'Returns the transaction history of your wallet')
register_command('importprivkey', 0, 1, 1, [('privkey', 'Private key')], [], 'Import a private key', '')
register_command('ismine', 0, 1, 0, [('address', 'Bitcoin address')], [], 'Check if address is in wallet', 'Return true if and only if address is in wallet')
register_command('listaddresses', 0, 1, 0, [], ['show_all', 'show_labels'], 'List wallet addresses', 'Returns your list of addresses.')
register_command('listunspent', 1, 1, 0, [], [], 'List unspent outputs', 'Returns the list of unspent transaction outputs in your wallet.')
register_command('getaddressunspent', 1, 0, 0, [('address', 'Bitcoin address')], [], 'Returns the list of unspent inputs for an address.', '')
register_command('mktx', 0, 1, 1, [('recipient', 'Bitcoin address'), ('amount', 'Amount in BTC')],
['tx_fee', 'from_addr', 'change_addr'], 'Create signed transaction', '')
register_command('payto', 1, 1, 1, {'recipient':'Bitcoin address', 'amount':'Amount in BTC'},
register_command('payto', 1, 1, 1, [('recipient', 'Bitcoin address'), ('amount', 'Amount in BTC')],
['tx_fee', 'from_addr', 'change_addr'], 'Create and broadcast a transaction.', '')
register_command('mktx_csv', 0, 1, 1, {'csv_file':'CSV file of recipient, amount'}, ['tx_fee', 'from_addr', 'change_addr'], 'Create a signed transaction', '')
register_command('payto_csv', 1, 1, 1, {'csv_file':''}, ['tx_fee', 'from_addr', 'change_addr'], 'Create and broadcast a transaction.', '')
register_command('password', 0, 1, 1, {}, [], 'Change your password', '')
register_command('restore', 1, 1, 0, {}, ['gap_limit', 'mpk', 'concealed'], 'Restore a wallet from seed', '')
register_command('searchcontacts', 0, 1, 0, {'query':''}, [], 'Search through contacts, return matching entries', '')
register_command('setconfig', 0, 0, 0, {'key':'', 'value':''}, [], 'Set a configuration variable', '')
register_command('setlabel', 0, 1, 0, {'txid':'Transaction ID', 'label':''}, [], 'Assign a label to an item', '')
register_command('sendrawtx', 1, 0, 0, {'tx':'Serialized transaction'}, [], 'Broadcast a transaction to the network.', '')
register_command('signtxwithkey', 0, 0, 0, {'tx':'raw_tx', 'key':''}, [], 'Sign a serialized transaction with a key', '')
register_command('signtxwithwallet', 0, 1, 1, {'tx':'raw_tx'}, [], 'Sign a serialized transaction with a wallet', '')
register_command('signmessage', 0, 1, 1, {'address':'Bitcoin address', 'message':'Message to sign.'}, [],
register_command('mktx_csv', 0, 1, 1, [('csv_file', 'CSV file of recipient, amount')], ['tx_fee', 'from_addr', 'change_addr'], 'Create a signed transaction', '')
register_command('payto_csv', 1, 1, 1, [('csv_file', '')], ['tx_fee', 'from_addr', 'change_addr'], 'Create and broadcast a transaction.', '')
register_command('password', 0, 1, 1, [], [], 'Change your password', '')
register_command('restore', 1, 1, 0, [], ['gap_limit', 'mpk', 'concealed'], 'Restore a wallet from seed', '')
register_command('searchcontacts', 0, 1, 0, [('query', '')], [], 'Search through contacts, return matching entries', '')
register_command('setconfig', 0, 0, 0, [('key', ''), ('value', '')], [], 'Set a configuration variable', '')
register_command('setlabel', 0, 1, 0, [('txid', 'Transaction ID'), ('label', '')], [], 'Assign a label to an item', '')
register_command('sendrawtx', 1, 0, 0, [('tx', 'Serialized transaction')], [], 'Broadcast a transaction to the network.', '')
register_command('signtxwithkey', 0, 0, 0, [('tx', 'raw_tx'), ('key', '')], [], 'Sign a serialized transaction with a key', '')
register_command('signtxwithwallet', 0, 1, 1, [('tx', 'raw_tx')], [], 'Sign a serialized transaction with a wallet', '')
register_command('signmessage', 0, 1, 1, [('address', 'Bitcoin address'), ('message', 'Message to sign.')], [],
'Sign a message with a key.', 'Use quotes if your message contains whitespaces')
register_command('unfreeze', 0, 1, 0, {'address':'Bitcoin address'}, [], 'Unfreeze the funds at one of your wallet\'s address', '')
register_command('validateaddress', 0, 0, 0, {'address':'Bitcoin address'}, [], 'Check that the address is valid', '')
register_command('verifymessage', 0, 0, 0, {'address':'Bitcoin address', 'signature':'Signature', 'message':'Message'}, [], 'Verify a signature', '')
register_command('version', 0, 0, 0, {}, [], 'Return the version of your client', '')
register_command('encrypt', 0, 0, 0, {'pubkey':'public key', 'message':'Message to encrypt.'}, [],
register_command('unfreeze', 0, 1, 0, [('address', 'Bitcoin address')], [], 'Unfreeze the funds at one of your wallet\'s address', '')
register_command('validateaddress', 0, 0, 0, [('address', 'Bitcoin address')], [], 'Check that the address is valid', '')
register_command('verifymessage', 0, 0, 0, [('address', 'Bitcoin address'), ('signature', 'Signature'), ('message', 'Message')], [], 'Verify a signature', '')
register_command('version', 0, 0, 0, [], [], 'Return the version of your client', '')
register_command('encrypt', 0, 0, 0, [('pubkey', 'public key'), ('message', 'Message to encrypt.')], [],
'Encrypt a message with a public key.', 'Use quotes if the message contains whitespaces.')
register_command('decrypt', 0, 1, 1, {'pubkey':'public key', 'message':'Encrypted message'}, [], 'Decrypt a message encrypted with a public key', '')
register_command('getmerkle', 1, 0, 0, {'txid':'Transaction ID', 'height':'Block height'}, [], 'Get Merkle branch of a transaction included in a block', '')
register_command('getproof', 1, 0, 0, {'address':''}, [], 'Get Merkle branch of an address in the UTXO set', '')
register_command('getutxoaddress', 1, 0, 0, {'txid':'Transction ID', 'pos':'Position'}, [], 'Get the address of an unspent transaction output', '')
register_command('sweep', 1, 0, 0, {'privkey':'Private key', 'address':'Destination address'}, ['tx_fee'], 'Sweep a private key.', '')
register_command('make_seed', 0, 0, 0, {}, ['nbits', 'entropy', 'language'], 'Create a seed.', '')
register_command('check_seed', 0, 0, 0, {'seed':'Seed phrase'}, ['entropy', 'language'], 'Check that a seed was generated with external entropy.', '')
register_command('decrypt', 0, 1, 1, [('pubkey', 'public key'), ('message', 'Encrypted message')], [], 'Decrypt a message encrypted with a public key', '')
register_command('getmerkle', 1, 0, 0, [('txid', 'Transaction ID'), ('height', 'Block height')], [], 'Get Merkle branch of a transaction included in a block', '')
register_command('getproof', 1, 0, 0, [('address', '')], [], 'Get Merkle branch of an address in the UTXO set', '')
register_command('getutxoaddress', 1, 0, 0, [('txid', 'Transction ID'), ('pos', 'Position')], [], 'Get the address of an unspent transaction output', '')
register_command('sweep', 1, 0, 0, [('privkey', 'Private key'), ('address', 'Destination address')], ['tx_fee'], 'Sweep a private key.', '')
register_command('make_seed', 0, 0, 0, [], ['nbits', 'entropy', 'language'], 'Create a seed.', '')
register_command('check_seed', 0, 0, 0, [('seed', 'Seed phrase')], ['entropy', 'language'], 'Check that a seed was generated with external entropy.', '')
@ -198,7 +198,7 @@ def get_parser(run_gui, run_daemon, run_cmdline):
action = "store_true" if type(default) is bool else 'store'
args = (a, b) if a else (b,)
p.add_argument(*args, dest=optname, action=action, default=default, help=help)
for param, h in cmd.params.items():
for param, h in cmd.params:
p.add_argument(param, help=h)
# 'gui' is the default command
parser.set_default_subparser('gui')