opts.py 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  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 cfg,help_notes,s: s.format(
  37. kgs=help_notes('keygen_backends'),
  38. coin_id=help_notes('coin_id'),
  39. ),
  40. 'notes': lambda s: s.format(nn='a note'),
  41. }
  42. }
  43. cfg = Config(opts_data=opts_data)
  44. if cfg._args == ['show_common_opts_diff']:
  45. from mmgen.opts import show_common_opts_diff
  46. show_common_opts_diff(cfg)
  47. sys.exit(0)
  48. for k in (
  49. 'foo', # added opt
  50. 'print_checksum', # sets 'quiet'
  51. 'quiet','verbose', # _incompatible_opts
  52. 'passwd_file', # _infile_opts - check_infile()
  53. 'outdir', # check_outdir()
  54. 'cached_balances', # opt_sets_global
  55. 'minconf', # global_sets_opt
  56. 'hidden_incog_input_params',
  57. ):
  58. msg('{:30} {}'.format( f'cfg.{k}:', getattr(cfg,k) ))
  59. msg('')
  60. for k in (
  61. 'cached_balances', # opt_sets_global
  62. 'minconf', # global_sets_opt
  63. ):
  64. msg('{:30} {}'.format( f'cfg.{k}:', getattr(cfg,k) ))
  65. msg('')
  66. for k in (
  67. 'fee_estimate_mode', # _autoset_opts
  68. ):
  69. msg('{:30} {}'.format( f'cfg.{k}:', getattr(cfg,k) ))