opts.py: remove show_common_opts_diff()

This commit is contained in:
The MMGen Project 2023-04-04 16:04:11 +00:00
commit 286105b73a
Signed by: mmgen
GPG key ID: 3F8B1861E32B7DA2
3 changed files with 0 additions and 34 deletions

View file

@ -207,33 +207,8 @@ def set_cfg_from_env(cfg):
else:
raise ValueError(f'{name!r} is not a valid MMGen environment variable')
def show_common_opts_diff(cfg):
def common_opts_data_to_list():
for l in common_opts_data['text'].splitlines():
if l.startswith('--,'):
yield l.split()[1].split('=')[0][2:].replace('-','_')
def do_fmt(set_data):
from .util import fmt_list
return fmt_list(['--'+s.replace('_','-') for s in set_data],fmt='col',indent=' ')
a = cfg._common_opts
b = list(common_opts_data_to_list())
a_minus_b = [e for e in a if e not in b]
b_minus_a = [e for e in b if e not in a]
a_and_b = [e for e in a if e in b]
from .util import msg
msg(f'cfg._common_opts - common_opts_data:\n {do_fmt(a_minus_b) if a_minus_b else "None"}\n')
msg(f'common_opts_data - cfg._common_opts (these do not set global var):\n{do_fmt(b_minus_a)}\n')
msg(f'common_opts_data ^ cfg._common_opts (these set global var):\n{do_fmt(a_and_b)}\n')
sys.exit(0)
common_opts_data = {
# Most but not all of these set the corresponding global var
# View differences with show_common_opts_diff()
'text': """
--, --accept-defaults Accept defaults at all prompts
--, --coin=c Choose coin unit. Default: BTC. Current choice: {cu_dfl}

View file

@ -47,11 +47,6 @@ sample note: {nn}
cfg = Config(opts_data=opts_data)
if cfg._args == ['show_common_opts_diff']:
from mmgen.opts import show_common_opts_diff
show_common_opts_diff(cfg)
sys.exit(0)
for k in (
'foo', # added opt
'print_checksum', # sets 'quiet'

View file

@ -25,7 +25,6 @@ class TestSuiteOpts(TestSuiteBase):
('opt_bad_outdir', (41,"bad outdir parameter", [])),
('opt_bad_incompatible', (41,"incompatible opts", [])),
('opt_bad_autoset', (41,"invalid autoset value", [])),
('opt_show_diff', (41,"show_common_opts_diff()", [])),
)
def spawn_prog(self,args):
@ -106,6 +105,3 @@ class TestSuiteOpts(TestSuiteBase):
def opt_bad_autoset(self):
return self.do_run(['--fee-estimate-mode=Fubar'],'not unique substring',1)
def opt_show_diff(self):
return self.do_run(['show_common_opts_diff'],'common_opts_data',0)