Browse Source

mmgen-tool: install fix, sort command names; version msg fix

The MMGen Project 3 years ago
parent
commit
ed7cc7498a
5 changed files with 49 additions and 40 deletions
  1. 1 1
      mmgen/data/version
  2. 40 38
      mmgen/main_tool.py
  3. 1 1
      mmgen/opts.py
  4. 1 0
      setup.cfg
  5. 6 0
      test/test_py_d/ts_misc.py

+ 1 - 1
mmgen/data/version

@@ -1 +1 @@
-13.1.dev009
+13.1.dev010

+ 40 - 38
mmgen/main_tool.py

@@ -67,64 +67,66 @@ Type '{pn} help <command>' for help on a particular command
 	}
 }
 
+# NB: Command groups and commands are displayed on the help screen in the following order,
+# so keep the command names sorted
 mods = {
 	'help': (
 		'help',
 		'usage',
 	),
 	'util': (
+		'b32tohex',
+		'b58chktohex',
+		'b58tobytes',
+		'b58tohex',
+		'b6dtohex',
 		'bytespec',
-		'to_bytespec',
-		'randhex',
-		'hexreverse',
-		'hexlify',
-		'unhexlify',
-		'hexdump',
-		'unhexdump',
+		'bytestob58',
 		'hash160',
 		'hash256',
-		'id6',
-		'str2id6',
-		'id8',
-		'randb58',
-		'bytestob58',
-		'b58tobytes',
+		'hexdump',
+		'hexlify',
+		'hexreverse',
+		'hextob32',
 		'hextob58',
-		'b58tohex',
 		'hextob58chk',
-		'b58chktohex',
-		'hextob32',
-		'b32tohex',
 		'hextob6d',
-		'b6dtohex',
+		'id6',
+		'id8',
+		'randb58',
+		'randhex',
+		'str2id6',
+		'to_bytespec',
+		'unhexdump',
+		'unhexlify',
 	),
 	'coin': (
-		'randwif',
-		'randpair',
-		'wif2hex',
+		'addr2pubhash',
+		'addr2scriptpubkey',
 		'hex2wif',
-		'wif2addr',
-		'wif2redeem_script',
-		'wif2segwit_pair',
 		'privhex2addr',
 		'privhex2pubhex',
+		'pubhash2addr',
 		'pubhex2addr',
 		'pubhex2redeem_script',
+		'randpair',
+		'randwif',
 		'redeem_script2addr',
-		'pubhash2addr',
-		'addr2pubhash',
-		'addr2scriptpubkey',
 		'scriptpubkey2addr',
+		'wif2addr',
+		'wif2hex',
+		'wif2redeem_script',
+		'wif2segwit_pair',
 	),
 	'mnemonic': (
-		'mn_rand128',
-		'mn_rand192',
-		'mn_rand256',
 		'hex2mn',
 		'mn2hex',
 		'mn2hex_interactive',
-		'mn_stats',
 		'mn_printlist',
+		'mn_rand128',
+		'mn_rand192',
+		'mn_rand256',
+		'mn_stats',
 	),
 	'file': (
 		'addrfile_chksum',
@@ -133,30 +135,30 @@ mods = {
 		'txview',
 	),
 	'filecrypt': (
-		'encrypt',
 		'decrypt',
+		'encrypt',
 	),
 	'fileutil': (
 		'find_incog_data',
 		'rand2file',
 	),
 	'wallet': (
+		'gen_addr',
+		'gen_key',
 		'get_subseed',
 		'get_subseed_by_seed_id',
-		'list_subseeds',
 		'list_shares',
-		'gen_key',
-		'gen_addr',
+		'list_subseeds',
 	),
 	'rpc': (
+		'add_label',
 		'daemon_version',
 		'getbalance',
 		'listaddress',
 		'listaddresses',
-		'twview',
-		'add_label',
-		'remove_label',
 		'remove_address',
+		'remove_label',
+		'twview',
 	),
 }
 

+ 1 - 1
mmgen/opts.py

@@ -40,7 +40,7 @@ def usage():
 	Die(1,mmgen.share.Opts.make_usage_str(g.prog_name,'user',usage_data))
 
 def version():
-	from .util import Die
+	from .util import Die,fmt
 	Die(0,fmt(f"""
 		{g.prog_name.upper()} version {g.version}
 		Part of the {g.proj_name} suite, an online/offline cryptocurrency wallet for the

+ 1 - 0
setup.cfg

@@ -42,6 +42,7 @@ install_requires =
 packages =
 	mmgen
 	mmgen.share
+	mmgen.tool
 	mmgen.altcoins
 	mmgen.altcoins.eth
 	mmgen.altcoins.eth.pyethereum

+ 6 - 0
test/test_py_d/ts_misc.py

@@ -48,6 +48,7 @@ class TestSuiteHelp(TestSuiteBase):
 	passthru_opts = ('daemon_data_dir','rpc_port','coin','testnet')
 	cmd_group = (
 		('usage',                 (1,'usage message',[])),
+		('version',               (1,'version message',[])),
 		('helpscreens',           (1,'help screens',             [])),
 		('longhelpscreens',       (1,'help screens (--longhelp)',[])),
 		('show_hash_presets',     (1,'info screen (--show-hash-presets)',[])),
@@ -61,6 +62,11 @@ class TestSuiteHelp(TestSuiteBase):
 		t.req_exit_val = 1
 		return t
 
+	def version(self):
+		t = self.spawn(f'mmgen-tool',['--version'])
+		t.expect('MMGEN-TOOL version')
+		return t
+
 	def helpscreens(self,arg='--help',scripts=(),expect='USAGE:.*OPTIONS:'):
 
 		scripts = scripts or tuple(s.replace('mmgen-','') for s in os.listdir('cmds'))