help usage, notes: add --coin opt where applicable
This commit is contained in:
parent
165d65d4ed
commit
71ee60a77b
3 changed files with 13 additions and 3 deletions
|
|
@ -82,10 +82,11 @@ def make_usage_str(cfg, *, caller):
|
|||
single_line = isinstance(cfg._usage_data, str)
|
||||
ulbl = 'USAGE:' + (' ' if single_line else join_str)
|
||||
for line in [cfg._usage_data.strip()] if single_line else cfg._usage_data:
|
||||
yield '{a}{b} {c}'.format(
|
||||
yield '{a}{b}{c} {d}'.format(
|
||||
a = ulbl,
|
||||
b = gc.prog_name,
|
||||
c = cfg._usage_code(*gen_arg_tuple(cfg, cfg._usage_code, line))
|
||||
c = '' if cfg.coin in (None, 'BTC') else f' --coin={cfg.coin.lower()}',
|
||||
d = cfg._usage_code(*gen_arg_tuple(cfg, cfg._usage_code, line))
|
||||
if cfg._usage_code else line)
|
||||
ulbl = ''
|
||||
join_str = {'help': '\n ', 'user': '\n '}[caller]
|
||||
|
|
|
|||
|
|
@ -21,6 +21,14 @@ class help_notes:
|
|||
self.proto = proto
|
||||
self.cfg = cfg
|
||||
|
||||
def cmd_coin_arg(self):
|
||||
from ..cfg import gc
|
||||
match self.proto.coin:
|
||||
case 'BTC':
|
||||
return gc.prog_name
|
||||
case _:
|
||||
return f'{gc.prog_name} --coin={self.proto.coin.lower()}'
|
||||
|
||||
def addrimport_args(self):
|
||||
match self.proto.base_proto:
|
||||
case 'Monero':
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@ help.txcreate_examples: txcreate and txdo help examples for the MMGen Wallet sui
|
|||
"""
|
||||
|
||||
from ..cfg import gc
|
||||
from . import help_notes
|
||||
|
||||
def help(proto, cfg):
|
||||
|
||||
|
|
@ -21,7 +22,7 @@ def help(proto, cfg):
|
|||
t = tool_cmd(cfg, mmtype=mmtype)
|
||||
addr = t.privhex2addr('bead' * 16)
|
||||
sample_addr = addr.views[addr.view_pref]
|
||||
cmd_base = gc.prog_name + ('' if proto.coin == 'BTC' else f' --coin={proto.coin.lower()}')
|
||||
cmd_base = help_notes.help_notes(proto, cfg).cmd_coin_arg()
|
||||
action = 'Create' if gc.prog_name == 'mmgen-txcreate' else 'Execute'
|
||||
|
||||
match proto.base_proto:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue