commit 94ac0db91fd66afba646450f0fcdec6081f99f7d
parent 65f20895df587aa6f42d5b03ee8597c6b38dfc64
Author: ThomasV <thomasv@electrum.org>
Date: Wed, 28 Oct 2015 09:33:35 +0100
command line: Require 'text' argument for 'restore'. Replace 'concealed' option with ':' magic word
Diffstat:
2 files changed, 9 insertions(+), 8 deletions(-)
diff --git a/electrum b/electrum
@@ -87,7 +87,7 @@ from electrum.commands import get_parser, known_commands, Commands, config_varia
# get password routine
def prompt_password(prompt, confirm=True):
import getpass
- password = getpass.getpass(prompt)
+ password = getpass.getpass(prompt, stream=None)
if password and confirm:
password2 = getpass.getpass("Confirm: ")
if password != password2:
@@ -141,8 +141,7 @@ def init_cmdline(config):
return prompt_password("Password (hit return if you do not wish to encrypt your wallet):")
if cmd.name == 'restore':
- import getpass
- text = getpass.getpass(prompt="seed:", stream=None) if config.get('concealed') else raw_input("seed or key(s):")
+ text = config.get('text')
try:
wallet = Wallet.from_text(text, password_dialog, storage)
except BaseException as e:
@@ -425,6 +424,8 @@ if __name__ == '__main__':
else:
raise BaseException('Cannot get argument from stdin')
elif arg == '?':
+ sys.argv[i] = raw_input("Enter argument:")
+ elif arg == ':':
sys.argv[i] = prompt_password('Enter argument (will not echo):', False)
# parse command line
diff --git a/lib/commands.py b/lib/commands.py
@@ -103,10 +103,11 @@ class Commands:
"""Create a new wallet"""
@command('')
- def restore(self, concealed=False):
- """Restore a wallet. A wallet can be restored from a seed phrase, a
- master public key, a master private key, a list of bitcoin addresses
- or bitcoin private keys."""
+ def restore(self, text):
+ """Restore a wallet from text. Text can be a seed phrase, a master
+ public key, a master private key, a list of bitcoin addresses
+ or bitcoin private keys. If you want to be prompted for your
+ seed, type '?' or ':' (concealed) """
@command('w')
def deseed(self):
@@ -615,7 +616,6 @@ param_descriptions = {
command_options = {
'password': ("-W", "--password", "Password"),
- 'concealed': ("-C", "--concealed", "Don't echo seed to console when restoring"),
'receiving': (None, "--receiving", "Show only receiving addresses"),
'change': (None, "--change", "Show only change addresses"),
'frozen': (None, "--frozen", "Show only frozen addresses"),