opts_main.py 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  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 (global) 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. -t, --min-temp= t Minimum temperature (in degrees Celsius)
  27. -T, --max-temp= t Maximum temperature (in degrees Celsius)
  28. -x, --point= P Point in Euclidean space
  29. -X, --cached-balances Use cached balances (Ethereum only)
  30. -v, --verbose Be more verbose
  31. sample help_note: {kgs}
  32. sample help_note: {coin_id}
  33. """,
  34. 'notes': """
  35. NOTES FOR THIS COMMAND
  36. sample note: {nn}
  37. """
  38. },
  39. 'code': {
  40. 'options': lambda cfg,help_notes,s: s.format(
  41. kgs=help_notes('keygen_backends'),
  42. coin_id=help_notes('coin_id'),
  43. ),
  44. 'notes': lambda s: s.format(nn='a note'),
  45. }
  46. }
  47. cfg = Config(opts_data=opts_data)
  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. 'keep_label',
  58. 'seed_len',
  59. 'hash_preset',
  60. 'label',
  61. 'min_temp',
  62. 'max_temp',
  63. 'coin',
  64. 'pager',
  65. 'point',
  66. ):
  67. msg('{:30} {}'.format( f'cfg.{k}:', getattr(cfg,k) ))
  68. msg('')
  69. for k in (
  70. 'cached_balances', # opt_sets_global
  71. 'minconf', # global_sets_opt
  72. ):
  73. msg('{:30} {}'.format( f'cfg.{k}:', getattr(cfg,k) ))
  74. msg('')
  75. for k in (
  76. 'fee_estimate_mode', # _autoset_opts
  77. ):
  78. msg('{:30} {}'.format( f'cfg.{k}:', getattr(cfg,k) ))
  79. msg('')
  80. for n, k in enumerate(cfg._args, 1):
  81. msg(f'arg{n}: {k}')