Browse Source

minor help notes cleanups

The MMGen Project 3 years ago
parent
commit
85941cb6e4

+ 25 - 0
mmgen/help.py

@@ -39,6 +39,31 @@ def help_notes_func(proto,po,k):
 
 	class help_notes:
 
+		def password_formats():
+			from .passwdlist import PasswordList
+			pwi_fs = '{:8} {:1} {:26} {:<7}  {:<7}  {}'
+			return '\n  '.join(
+				[pwi_fs.format('Code','','Description','Min Len','Max Len','Default Len')] +
+				[pwi_fs.format(k,'-',v.desc,v.min_len,v.max_len,v.dfl_len) for k,v in PasswordList.pw_info.items()]
+			)
+
+		def dfl_mmtype():
+			from .addr import MMGenAddrType
+			return "'{}' or '{}'".format(
+				proto.dfl_mmtype,
+				MMGenAddrType.mmtypes[proto.dfl_mmtype].name )
+
+		def address_types():
+			from .addr import MMGenAddrType
+			return '\n  '.join([
+				"'{}','{:<12} - {}".format( k, v.name+"'", v.desc )
+					for k,v in MMGenAddrType.mmtypes.items()
+			])
+
+		def fmt_codes():
+			from .wallet import Wallet
+			return '\n  '.join( Wallet.format_fmt_codes().splitlines() )
+
 		def coin_id():
 			return proto.coin_id
 

+ 3 - 4
mmgen/main_addrgen.py

@@ -106,7 +106,7 @@ FMT CODES:
 	'code': {
 		'options': lambda proto,help_notes,s: s.format(
 			seed_lens=', '.join(map(str,g.seed_lens)),
-			dmat="'{}' or '{}'".format(proto.dfl_mmtype,MMGenAddrType.mmtypes[proto.dfl_mmtype].name),
+			dmat=help_notes('dfl_mmtype'),
 			kgs=help_notes('keygen_backends'),
 			coin_id=help_notes('coin_id'),
 			pnm=g.proj_name,
@@ -118,9 +118,8 @@ FMT CODES:
 			n_sw=help_notes('subwallet')+'\n\n',
 			n_pw=help_notes('passwd')+'\n\n',
 			n_bw=help_notes('brainwallet'),
-			n_fmt='\n  '.join(Wallet.format_fmt_codes().splitlines()),
-			n_at='\n  '.join(["'{}','{:<12} - {}".format(
-				k,v.name+"'",v.desc) for k,v in MMGenAddrType.mmtypes.items()])
+			n_fmt=help_notes('fmt_codes'),
+			n_at=help_notes('address_types'),
 		)
 	}
 }

+ 2 - 5
mmgen/main_passgen.py

@@ -29,7 +29,6 @@ from .wallet import Wallet
 from .obj import MMGenPWIDString
 
 pwi = PasswordList.pw_info
-pwi_fs = '{:8} {:1} {:26} {:<7}  {:<7}  {}'
 
 opts_data = {
 	'sets': [('print_checksum',True,'quiet',True)],
@@ -126,10 +125,8 @@ FMT CODES:
 				fs="', '".join(MMGenPWIDString.forbidden),
 				n_pw=help_notes('passwd'),
 				n_bw=help_notes('brainwallet'),
-				pfi='\n  '.join(
-					[pwi_fs.format('Code','','Description','Min Len','Max Len','Default Len')] +
-					[pwi_fs.format(k,'-',v.desc,v.min_len,v.max_len,v.dfl_len) for k,v in pwi.items()]),
-				n_fmt='\n  '.join(Wallet.format_fmt_codes().splitlines())
+				pfi=help_notes('password_formats'),
+				n_fmt=help_notes('fmt_codes'),
 		)
 	}
 }

+ 1 - 1
mmgen/main_seedjoin.py

@@ -84,7 +84,7 @@ FMT CODES:
 			g=g,
 		),
 		'notes': lambda help_notes,s: s.format(
-			f='\n  '.join(Wallet.format_fmt_codes().splitlines()),
+			f=help_notes('fmt_codes'),
 			n_pw=help_notes('passwd'),
 		)
 	}

+ 3 - 1
mmgen/main_txbump.py

@@ -76,6 +76,8 @@ opts_data = {
 Seed source files must have the canonical extensions listed in the 'FileExt'
 column below:
 
+FMT CODES:
+
   {f}
 """
 	},
@@ -92,7 +94,7 @@ column below:
 		'notes': lambda help_notes,s: s.format(
 			help_notes('fee'),
 			help_notes('txsign'),
-			f='\n  '.join(Wallet.format_fmt_codes().splitlines()))
+			f=help_notes('fmt_codes')),
 	}
 }
 

+ 3 - 1
mmgen/main_txdo.py

@@ -88,6 +88,8 @@ opts_data = {
 Seed source files must have the canonical extensions listed in the 'FileExt'
 column below:
 
+FMT CODES:
+
   {f}
 """
 	},
@@ -107,7 +109,7 @@ column below:
 			help_notes('txcreate'),
 			help_notes('fee'),
 			help_notes('txsign'),
-			f='\n  '.join(Wallet.format_fmt_codes().splitlines()))
+			f=help_notes('fmt_codes')),
 	}
 }
 

+ 3 - 1
mmgen/main_txsign.py

@@ -73,6 +73,8 @@ opts_data = {
 Seed source files must have the canonical extensions listed in the 'FileExt'
 column below:
 
+FMT CODES:
+
   {f}
 """
 	},
@@ -88,7 +90,7 @@ column below:
 			cu=proto.coin),
 		'notes': lambda help_notes,s: s.format(
 			help_notes('txsign'),
-			f='\n  '.join(Wallet.format_fmt_codes().splitlines()))
+			f=help_notes('fmt_codes')),
 	}
 }
 

+ 1 - 1
mmgen/main_wallet.py

@@ -134,7 +134,7 @@ FMT CODES:
 			g=g,
 		),
 		'notes': lambda help_notes,s: s.format(
-			f='\n  '.join(Wallet.format_fmt_codes().splitlines()),
+			f=help_notes('fmt_codes'),
 			n_ss=('',help_notes('seedsplit')+'\n\n')[do_ss_note],
 			n_sw=('',help_notes('subwallet')+'\n\n')[do_sw_note],
 			n_pw=help_notes('passwd'),