Browse Source

help usage, notes: add --coin opt where applicable

The MMGen Project 1 week ago
parent
commit
71ee60a77b
3 changed files with 13 additions and 3 deletions
  1. 3 2
      mmgen/help/__init__.py
  2. 8 0
      mmgen/help/help_notes.py
  3. 2 1
      mmgen/help/txcreate_examples.py

+ 3 - 2
mmgen/help/__init__.py

@@ -82,10 +82,11 @@ def make_usage_str(cfg, *, caller):
 		single_line = isinstance(cfg._usage_data, str)
 		single_line = isinstance(cfg._usage_data, str)
 		ulbl = 'USAGE:' + (' ' if single_line else join_str)
 		ulbl = 'USAGE:' + (' ' if single_line else join_str)
 		for line in [cfg._usage_data.strip()] if single_line else cfg._usage_data:
 		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,
 				a = ulbl,
 				b = gc.prog_name,
 				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)
 					if cfg._usage_code else line)
 			ulbl = ''
 			ulbl = ''
 	join_str = {'help': '\n    ', 'user': '\n  '}[caller]
 	join_str = {'help': '\n    ', 'user': '\n  '}[caller]

+ 8 - 0
mmgen/help/help_notes.py

@@ -21,6 +21,14 @@ class help_notes:
 		self.proto = proto
 		self.proto = proto
 		self.cfg = cfg
 		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):
 	def addrimport_args(self):
 		match self.proto.base_proto:
 		match self.proto.base_proto:
 			case 'Monero':
 			case 'Monero':

+ 2 - 1
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 ..cfg import gc
+from . import help_notes
 
 
 def help(proto, cfg):
 def help(proto, cfg):
 
 
@@ -21,7 +22,7 @@ def help(proto, cfg):
 	t = tool_cmd(cfg, mmtype=mmtype)
 	t = tool_cmd(cfg, mmtype=mmtype)
 	addr = t.privhex2addr('bead' * 16)
 	addr = t.privhex2addr('bead' * 16)
 	sample_addr = addr.views[addr.view_pref]
 	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'
 	action = 'Create' if gc.prog_name == 'mmgen-txcreate' else 'Execute'
 
 
 	match proto.base_proto:
 	match proto.base_proto: