1
1
#!/usr/bin/env python
2
-
3
- from platform import platform
4
- import pkg_resources
5
2
import re
6
3
import readline
7
4
import sys
8
-
9
5
from cmd import Cmd
6
+ from platform import platform
7
+ from pkg_resources import DistributionNotFound , get_distribution
10
8
11
9
import buidl # noqa: F401 (used below with pkg_resources for versioning)
12
-
13
10
from buidl .hd import HDPrivateKey , HDPublicKey
14
11
from buidl .helper import sha256 , hash256
15
12
from buidl .mnemonic import WORD_LIST , WORD_LOOKUP
@@ -61,6 +58,13 @@ def print_red(string):
61
58
print (red_fg (string ))
62
59
63
60
61
+ def _get_buidl_version ():
62
+ try :
63
+ return get_distribution ("buidl" ).version
64
+ except DistributionNotFound :
65
+ return "Unknown"
66
+
67
+
64
68
def _get_all_valid_checksum_words (first_words ):
65
69
to_return = []
66
70
for word in WORD_LIST :
@@ -621,10 +625,11 @@ def do_psbt_signer(self, arg):
621
625
else :
622
626
return _abort ("PSBT wasn't signed" )
623
627
624
- def do_settings (self , arg ):
625
- """Print program settings"""
628
+ def do_debug (self , arg ):
629
+ """Print program settings for debug purposes"""
630
+
626
631
to_print = [
627
- f"buidl Version: { pkg_resources . get_distribution ( 'buidl' ). version } " ,
632
+ f"buidl Version: { _get_buidl_version () } " ,
628
633
f"Python Version: { sys .version_info } " ,
629
634
f"Platform: { platform ()} " ,
630
635
f"libsecp256k1 Configured: { _is_libsec_enabled ()} " ,
@@ -633,15 +638,15 @@ def do_settings(self, arg):
633
638
634
639
def do_exit (self , arg ):
635
640
"""Exit Program"""
636
- print_yellow ("\n No data saved\n " )
641
+ print_yellow ("\n No data saved" )
637
642
return True
638
643
639
644
640
645
def main ():
641
646
try :
642
647
MyPrompt ().cmdloop ()
643
648
except KeyboardInterrupt :
644
- print_yellow ("\n No data saved\n " )
649
+ print_yellow ("\n No data saved" )
645
650
646
651
647
652
if __name__ == "__main__" :
0 commit comments