[opts]: separate code from text in opts_data

- When parsing opts, opts.init() now looks only at string values from
  opts_data.  Global variables are evaluated only when printing help text,
  after the variables are initialized
This commit is contained in:
The MMGen Project 2019-03-26 12:59:30 +00:00
commit 017ecef3bc
Signed by: mmgen
GPG key ID: 3F8B1861E32B7DA2
27 changed files with 385 additions and 247 deletions

View file

@ -40,10 +40,11 @@ from mmgen.seed import is_mnemonic
def is_str(s): return type(s) == str
opts_data = lambda: {
'desc': "Simple test suite for the 'mmgen-tool' utility",
'usage':'[options] [command]',
'options': """
opts_data = {
'text': {
'desc': "Simple test suite for the 'mmgen-tool' utility",
'usage':'[options] [command]',
'options': """
-h, --help Print this help message
-C, --coverage Produce code coverage info using trace module
-d, --die-on-missing Abort if no test data found for given command
@ -63,6 +64,7 @@ opts_data = lambda: {
If no command is given, the whole suite of tests is run.
"""
}
}
sample_text_hexdump = (