opts_main.py 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  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. -F, --no-foobleize Do not foobleize the output, even on user request
  17. -H, --hidden-incog-input-params=f,o Read hidden incognito data from file
  18. 'f' at offset 'o' (comma-separated)
  19. -k, --keep-label Reuse label of input wallet for output wallet
  20. -l, --seed-len= l Specify wallet seed length of 'l' bits.
  21. -L, --label= l Specify a label 'l' for output wallet
  22. -m, --minconf= n Minimum number of confirmations required to spend
  23. outputs (default: 1)
  24. -p, --hash-preset= p Use the scrypt hash parameters defined by preset 'p'
  25. -P, --passwd-file= f Get wallet passphrase from file 'f'
  26. -q, --quiet Be quieter
  27. -t, --min-temp= t Minimum temperature (in degrees Celsius)
  28. -T, --max-temp= t Maximum temperature (in degrees Celsius)
  29. -x, --point= P Point in Euclidean space
  30. -X, --cached-balances Use cached balances (Ethereum only)
  31. -v, --verbose Be more verbose
  32. sample help_note: {kgs}
  33. sample help_note: {coin_id}
  34. """,
  35. 'notes': """
  36. NOTES FOR THIS COMMAND
  37. sample note: {nn}
  38. """
  39. },
  40. 'code': {
  41. 'options': lambda cfg, help_notes, s: s.format(
  42. kgs=help_notes('keygen_backends'),
  43. coin_id=help_notes('coin_id'),
  44. ),
  45. 'notes': lambda s: s.format(nn='a note'),
  46. }
  47. }
  48. cfg = Config(opts_data=opts_data)
  49. for k in (
  50. 'foo', # added opt
  51. 'print_checksum', # sets 'quiet'
  52. 'quiet', 'verbose', # _incompatible_opts
  53. 'passwd_file', # _infile_opts - check_infile()
  54. 'outdir', # check_outdir()
  55. 'cached_balances', # opt_sets_global
  56. 'minconf', # global_sets_opt
  57. 'hidden_incog_input_params',
  58. 'keep_label',
  59. 'seed_len',
  60. 'hash_preset',
  61. 'label',
  62. 'min_temp',
  63. 'max_temp',
  64. 'coin',
  65. 'pager',
  66. 'point',
  67. 'no_foobleize'):
  68. msg('{:30} {}'.format(f'cfg.{k}:', getattr(cfg, k)))
  69. msg('')
  70. for k in (
  71. 'cached_balances', # opt_sets_global
  72. 'minconf'): # global_sets_opt
  73. msg('{:30} {}'.format(f'cfg.{k}:', getattr(cfg, k)))
  74. msg('')
  75. for k in ('fee_estimate_mode',): # _autoset_opts
  76. msg('{:30} {}'.format(f'cfg.{k}:', getattr(cfg, k)))
  77. msg('')
  78. for n, k in enumerate(cfg._args, 1):
  79. msg(f'arg{n}: {k}')