Browse Source

mmgen-txcreate: help screen cleanups

The MMGen Project 3 days ago
parent
commit
6ef5f6c797
3 changed files with 16 additions and 10 deletions
  1. 5 4
      mmgen/help/help_notes.py
  2. 7 2
      mmgen/help/txcreate_examples.py
  3. 4 4
      mmgen/main_txcreate.py

+ 5 - 4
mmgen/help/help_notes.py

@@ -19,10 +19,11 @@ class help_notes:
 		self.cfg = cfg
 		self.cfg = cfg
 
 
 	def txcreate_args(self):
 	def txcreate_args(self):
-		return (
-			'[ADDR,AMT ... | DATA_SPEC] ADDR'
-				if self.proto.base_proto == 'Bitcoin' else
-			'ADDR,AMT')
+		match self.proto.base_proto:
+			case 'Bitcoin':
+				return '[ADDR,AMT ... | DATA_SPEC] ADDR [addr file ...]'
+			case _:
+				return 'ADDR,AMT [addr file ...]'
 
 
 	def swaptxcreate_args(self):
 	def swaptxcreate_args(self):
 		return 'COIN1 [AMT CHG_ADDR] COIN2 [ADDR]'
 		return 'COIN1 [AMT CHG_ADDR] COIN2 [ADDR]'

+ 7 - 2
mmgen/help/txcreate_examples.py

@@ -22,7 +22,9 @@ def help(proto, cfg):
 	addr = t.privhex2addr('bead' * 16)
 	addr = t.privhex2addr('bead' * 16)
 	sample_addr = addr.views[addr.view_pref]
 	sample_addr = addr.views[addr.view_pref]
 
 
-	return f"""
+	match proto.base_proto:
+		case 'Bitcoin':
+			return f"""
 EXAMPLES:
 EXAMPLES:
 
 
   Send 0.123 {proto.coin} to an external {proto.name} address, returning the change to a
   Send 0.123 {proto.coin} to an external {proto.name} address, returning the change to a
@@ -52,7 +54,10 @@ EXAMPLES:
   address of specified type:
   address of specified type:
 
 
     $ {gc.prog_name} {mmtype}
     $ {gc.prog_name} {mmtype}
-""" if proto.base_proto == 'Bitcoin' else f"""
+"""
+
+		case _:
+			return f"""
 EXAMPLES:
 EXAMPLES:
 
 
   Send 0.123 {proto.coin} to an external {proto.name} address:
   Send 0.123 {proto.coin} to an external {proto.name} address:

+ 4 - 4
mmgen/main_txcreate.py

@@ -37,14 +37,14 @@ opts_data = {
 			'tx':     f'Create a transaction with outputs to specified coin or {gc.proj_name} addresses',
 			'tx':     f'Create a transaction with outputs to specified coin or {gc.proj_name} addresses',
 			'swaptx': f'Create a DEX swap transaction from one {gc.proj_name} tracking wallet to another',
 			'swaptx': f'Create a DEX swap transaction from one {gc.proj_name} tracking wallet to another',
 		}[target],
 		}[target],
-		'usage':   '[opts] {u_args} [addr file ...]',
+		'usage':   '[opts] {u_args}',
 		'options': """
 		'options': """
 			-- -h, --help            Print this help message
 			-- -h, --help            Print this help message
 			-- --, --longhelp        Print help message for long (global) options
 			-- --, --longhelp        Print help message for long (global) options
 			-- -a, --autosign        Create a transaction for offline autosigning (see
 			-- -a, --autosign        Create a transaction for offline autosigning (see
 			+                        ‘mmgen-autosign’). The removable device is mounted and
 			+                        ‘mmgen-autosign’). The removable device is mounted and
 			+                        unmounted automatically
 			+                        unmounted automatically
-			r- -A, --fee-adjust=  f  Adjust transaction fee by factor ‘f’ (see below)
+			R- -A, --fee-adjust=  f  Adjust transaction fee by factor ‘f’ (see below)
 			-- -B, --no-blank        Don't blank screen before displaying {a_info}
 			-- -B, --no-blank        Don't blank screen before displaying {a_info}
 			-- -c, --comment-file=f  Source the transaction's comment from file 'f'
 			-- -c, --comment-file=f  Source the transaction's comment from file 'f'
 			b- -C, --fee-estimate-confs=c Desired number of confirmations for fee estimation
 			b- -C, --fee-estimate-confs=c Desired number of confirmations for fee estimation
@@ -53,7 +53,7 @@ opts_data = {
 			e- -D, --contract-data=D Path to file containing hex-encoded contract data
 			e- -D, --contract-data=D Path to file containing hex-encoded contract data
 			b- -E, --fee-estimate-mode=M Specify the network fee estimate mode.  Choices:
 			b- -E, --fee-estimate-mode=M Specify the network fee estimate mode.  Choices:
 			+                        {fe_all}.  Default: {fe_dfl!r}
 			+                        {fe_all}.  Default: {fe_dfl!r}
-			r- -f, --fee=         f  Transaction fee, as a decimal {cu} amount or as
+			R- -f, --fee=         f  Transaction fee, as a decimal {cu} amount or as
 			+                        {fu} (an integer followed by {fl}).
 			+                        {fu} (an integer followed by {fl}).
 			+                        See FEE SPECIFICATION below.  If omitted, fee will be
 			+                        See FEE SPECIFICATION below.  If omitted, fee will be
 			+                        calculated using network fee estimation.
 			+                        calculated using network fee estimation.
@@ -63,7 +63,7 @@ opts_data = {
 			+                        (integer).  When unset, a hardcoded default will be
 			+                        (integer).  When unset, a hardcoded default will be
 			+                        used.  Applicable only for swaps from token assets.
 			+                        used.  Applicable only for swaps from token assets.
 			-- -i, --info            Display {a_info} and exit
 			-- -i, --info            Display {a_info} and exit
-			-- -I, --inputs=      i  Specify transaction inputs (comma-separated list of
+			R- -I, --inputs=      i  Specify transaction inputs (comma-separated list of
 			+                        MMGen IDs or coin addresses).  Note that ALL unspent
 			+                        MMGen IDs or coin addresses).  Note that ALL unspent
 			+                        outputs associated with each address will be included.
 			+                        outputs associated with each address will be included.
 			bt -l, --locktime=    t  Lock time (block height or unix seconds) (default: 0)
 			bt -l, --locktime=    t  Lock time (block height or unix seconds) (default: 0)