From 91156f68473c9b674b5ec8ea4cb9234f041eb66a Mon Sep 17 00:00:00 2001 From: The MMGen Project Date: Fri, 21 Jan 2022 11:23:43 +0000 Subject: [PATCH] globalvars.py: required_opts -> init_opts --- mmgen/globalvars.py | 9 ++------- mmgen/opts.py | 2 +- test/misc/opts.py | 2 +- test/test_py_d/ts_opts.py | 4 ++-- 4 files changed, 6 insertions(+), 11 deletions(-) diff --git a/mmgen/globalvars.py b/mmgen/globalvars.py index 9dc9b812..ca019a19 100755 --- a/mmgen/globalvars.py +++ b/mmgen/globalvars.py @@ -168,13 +168,8 @@ class GlobalContext(Lockable): 'daemon_data_dir','force_256_color','regtest','coin','bob','alice', 'accept_defaults','token','ignore_daemon_version','daemon_id','http_timeout', ) - # opts initialized to None by opts.init() if not set by user - required_opts = ( - 'quiet','verbose','debug','outdir','echo_passphrase','passwd_file','stdout', - 'show_hash_presets','label','keep_passphrase','keep_hash_preset','yes', - 'brain_params','b16','usr_randchars','coin','bob','alice', - 'hidden_incog_input_params','in_fmt','hash_preset','seed_len', - ) + # opts not in common_opts but required to be set during opts initialization + init_opts = ('show_hash_presets','yes','verbose') incompatible_opts = ( ('help','longhelp'), ('bob','alice'), diff --git a/mmgen/opts.py b/mmgen/opts.py index a420f193..ba87c1c1 100755 --- a/mmgen/opts.py +++ b/mmgen/opts.py @@ -253,7 +253,7 @@ def init(opts_data=None,add_opts=None,init_opts=None,opt_filter=None,parse_only= + po.skipped_opts + tuple(add_opts or []) + tuple(init_opts or []) - + g.required_opts + + g.init_opts + g.common_opts ): setattr(opt,o,po.user_opts[o] if o in po.user_opts else None) diff --git a/test/misc/opts.py b/test/misc/opts.py index 5602f9eb..156eba0e 100755 --- a/test/misc/opts.py +++ b/test/misc/opts.py @@ -53,7 +53,7 @@ if cmd_args == ['show_common_opts_diff']: for k in ( 'foo', # added opt 'print_checksum', # sets 'quiet' - 'quiet','verbose', # required_opts, incompatible_opts + 'quiet','verbose', # init_opts, incompatible_opts 'fee_estimate_mode', # autoset_opts 'passwd_file', # infile_opts - check_infile() 'outdir', # check_outdir() diff --git a/test/test_py_d/ts_opts.py b/test/test_py_d/ts_opts.py index 74738374..51caa6ff 100755 --- a/test/test_py_d/ts_opts.py +++ b/test/test_py_d/ts_opts.py @@ -59,8 +59,8 @@ class TestSuiteOpts(TestSuiteBase): ( ('opt.foo', 'None'), # added opt ('opt.print_checksum', 'None'), # sets 'quiet' - ('opt.quiet', 'False'), # required_opts, incompatible_opts - ('opt.verbose', 'None'), # required_opts, incompatible_opts + ('opt.quiet', 'False'), # init_opts, incompatible_opts + ('opt.verbose', 'None'), # init_opts, incompatible_opts ('opt.fee_estimate_mode', 'conservative'), # autoset_opts ('opt.passwd_file', 'None'), # infile_opts - check_infile() ('opt.outdir', 'None'), # check_outdir()