opts.py 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  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. -u, --subseeds= n The number of subseed pairs to scan for
  25. -q, --quiet Be quieter
  26. -v, --verbose Be more verbose
  27. """,
  28. 'notes': """
  29. NOTES FOR THIS COMMAND
  30. {nn}
  31. """
  32. },
  33. 'code': {
  34. 'options': lambda s: s.format(
  35. g=g,
  36. ),
  37. 'notes': lambda s: s.format(nn='a note'),
  38. }
  39. }
  40. cmd_args = opts.init(opts_data,add_opts=['foo'])
  41. if cmd_args == ['show_common_opts_diff']:
  42. from mmgen.opts import show_common_opts_diff
  43. show_common_opts_diff()
  44. sys.exit(0)
  45. for k in (
  46. 'foo', # added opt
  47. 'print_checksum', # sets 'quiet'
  48. 'quiet','verbose', # required_opts, incompatible_opts
  49. 'fee_estimate_mode', # autoset_opts
  50. 'passwd_file', # infile_opts - check_infile()
  51. 'outdir', # check_outdir()
  52. 'subseeds', # opt_sets_global
  53. 'minconf', # global_sets_opt
  54. 'hidden_incog_input_params',
  55. ):
  56. msg('{:30} {}'.format( f'opt.{k}:', getattr(opt,k) ))
  57. msg('')
  58. for k in (
  59. 'subseeds', # opt_sets_global
  60. 'minconf', # global_sets_opt
  61. ):
  62. msg('{:30} {}'.format( f'g.{k}:', getattr(opt,k) ))