From 71ee60a77bf4061121b9109bbf3fd0816a64b75e Mon Sep 17 00:00:00 2001 From: The MMGen Project Date: Tue, 5 May 2026 12:07:32 +0000 Subject: [PATCH] help usage, notes: add --coin opt where applicable --- mmgen/help/__init__.py | 5 +++-- mmgen/help/help_notes.py | 8 ++++++++ mmgen/help/txcreate_examples.py | 3 ++- 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/mmgen/help/__init__.py b/mmgen/help/__init__.py index 3214027e..9524f08c 100755 --- a/mmgen/help/__init__.py +++ b/mmgen/help/__init__.py @@ -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] diff --git a/mmgen/help/help_notes.py b/mmgen/help/help_notes.py index 2f471552..ae45b5dc 100755 --- a/mmgen/help/help_notes.py +++ b/mmgen/help/help_notes.py @@ -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': diff --git a/mmgen/help/txcreate_examples.py b/mmgen/help/txcreate_examples.py index b3650786..185fc8c1 100755 --- a/mmgen/help/txcreate_examples.py +++ b/mmgen/help/txcreate_examples.py @@ -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: