minor cleanups

This commit is contained in:
The MMGen Project 2023-04-04 16:04:10 +00:00
commit 3896293652
Signed by: mmgen
GPG key ID: 3F8B1861E32B7DA2
4 changed files with 23 additions and 13 deletions

View file

@ -17,7 +17,7 @@ import time
import mmgen.opts as opts
from mmgen.util import async_run
cfg = opts.init({
opts_data = {
'text': {
'desc': 'Estimate date of next block subsidy halving',
'usage':'[opts]',
@ -37,7 +37,9 @@ A more full-featured version of this program can be found in the
mmgen-node-tools repository.
"""
}
})
}
cfg = opts.init(opts_data)
def date(t):
return '{}-{:02}-{:02} {:02}:{:02}:{:02}'.format(*time.gmtime(t)[:6])

View file

@ -7,7 +7,7 @@ sys.path[0] = os.curdir
from mmgen.common import *
cfg = opts.init({
opts_data = {
'text': {
'desc': '',
'usage': '',
@ -18,7 +18,10 @@ cfg = opts.init({
-L, --label=l d
-m, --keep-label e
"""
}},init_opts={'color':True})
}
}
cfg = opts.init( opts_data, init_opts={'color':True} )
def crypto():
desc = 'test data'

View file

@ -7,7 +7,15 @@ sys.path[0] = os.curdir
from mmgen.common import *
cfg = opts.init({'text': { 'desc': '', 'usage':'', 'options':'-e, --echo-passphrase foo' }})
opts_data = {
'text': {
'desc': '',
'usage':'',
'options':'-e, --echo-passphrase foo',
}
}
cfg = opts.init(opts_data)
cmd_args = cfg._args

View file

@ -1,11 +1,5 @@
#!/usr/bin/env python3
from mmgen.common import *
cfg = opts.init()
from mmgen.util import msg
text = {
'gr': 'Greek text: {}'.format(''.join(map(chr,list(range(913,939))))),
'ru': 'Russian text: {}'.format(''.join(map(chr,list(range(1040,1072))))),
@ -13,7 +7,10 @@ text = {
'jp': 'Japanese text: {}'.format('必要なのは、信用ではなく暗号化された証明に基づく電子取引システムであり、')
}
if not cfg._args or not cfg._args[0] in text:
import sys
from mmgen.util import msg,die
if len(sys.argv) != 2 or not sys.argv[1] in text:
die(2,'argument must be one of {}'.format(list(text.keys())))
msg(text[cfg._args[0]])
msg(text[sys.argv[1]])