opts.py 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. #!/usr/bin/env python3
  2. from mmgen.common import *
  3. opts_data = {
  4. 'sets': [('print_checksum',True,'quiet',True)],
  5. 'text': {
  6. 'desc': 'Opts test',
  7. 'usage':'[args] [opts]',
  8. 'options': """
  9. -h, --help Print this help message
  10. --, --longhelp Print help message for long options (common options)
  11. -i, --in-fmt= f Input is from wallet format 'f'
  12. -d, --outdir= d Use outdir 'd'
  13. -C, --print-checksum Print a checksum
  14. -E, --fee-estimate-mode=M Specify the network fee estimate mode.
  15. -H, --hidden-incog-input-params=f,o Read hidden incognito data from file
  16. 'f' at offset 'o' (comma-separated)
  17. -k, --keep-label Reuse label of input wallet for output wallet
  18. -l, --seed-len= l Specify wallet seed length of 'l' bits.
  19. -L, --label= l Specify a label 'l' for output wallet
  20. -m, --minconf= n Minimum number of confirmations required to spend
  21. outputs (default: 1)
  22. -p, --hash-preset= p Use the scrypt hash parameters defined by preset 'p'
  23. -P, --passwd-file= f Get wallet passphrase from file 'f'
  24. -q, --quiet Be quieter
  25. -X, --cached-balances Use cached balances (Ethereum only)
  26. -v, --verbose Be more verbose
  27. sample help_note: {kgs}
  28. sample help_note: {coin_id}
  29. """,
  30. 'notes': """
  31. NOTES FOR THIS COMMAND
  32. sample note: {nn}
  33. """
  34. },
  35. 'code': {
  36. 'options': lambda help_notes,s: s.format(
  37. kgs=help_notes('keygen_backends'),
  38. coin_id=help_notes('coin_id'),
  39. g=g,
  40. ),
  41. 'notes': lambda s: s.format(nn='a note'),
  42. }
  43. }
  44. cmd_args = opts.init(opts_data)
  45. if cmd_args == ['show_common_opts_diff']:
  46. from mmgen.opts import show_common_opts_diff
  47. show_common_opts_diff()
  48. sys.exit(0)
  49. for k in (
  50. 'foo', # added opt
  51. 'print_checksum', # sets 'quiet'
  52. 'quiet','verbose', # init_opts, incompatible_opts
  53. 'fee_estimate_mode', # autoset_opts
  54. 'passwd_file', # infile_opts - check_infile()
  55. 'outdir', # check_outdir()
  56. 'cached_balances', # opt_sets_global
  57. 'minconf', # global_sets_opt
  58. 'hidden_incog_input_params',
  59. ):
  60. msg('{:30} {}'.format( f'opt.{k}:', getattr(opt,k) ))
  61. msg('')
  62. for k in (
  63. 'cached_balances', # opt_sets_global
  64. 'minconf', # global_sets_opt
  65. ):
  66. msg('{:30} {}'.format( f'g.{k}:', getattr(opt,k) ))