opts_main.py 2.3 KB

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