'--no-op' renamed to '--dry-run'
This commit is contained in:
parent
282bd0426c
commit
a21ffe4e03
@ -1014,8 +1014,8 @@ def get_storage_locker():
|
||||
@main.command('coldcardify')
|
||||
@click.argument('file', type=click.File("r+"), required=True)
|
||||
@click.option('--outfile', '-o', type=click.File('w'), help="output file path where adjusted wallet file is written")
|
||||
@click.option('--no-op', default=False, is_flag=True, help="do not write files instead pretty print to console")
|
||||
def electrum_coldcardify(file, outfile, no_op):
|
||||
@click.option('--dry-run', '-n', default=False, is_flag=True, help="do not write files instead pretty print to console")
|
||||
def electrum_coldcardify(file, outfile, dry_run):
|
||||
"""
|
||||
Coldcardify electrum wallet file.
|
||||
|
||||
@ -1045,7 +1045,7 @@ def electrum_coldcardify(file, outfile, no_op):
|
||||
|
||||
file_name = os.path.basename(file.name)
|
||||
|
||||
if outfile is None and no_op is False:
|
||||
if outfile is None and dry_run is False:
|
||||
# only create temp file if we're overwriting the existing original file
|
||||
with tempfile.NamedTemporaryFile(mode="w", delete=False, prefix=file_name + "_") as temp_f:
|
||||
temp_f.write(file.read())
|
||||
@ -1095,7 +1095,7 @@ def electrum_coldcardify(file, outfile, no_op):
|
||||
master_ext_pubkey = dev.send_recv(CCProtocolPacker.get_xpub("m"), timeout=None)
|
||||
contents[KEYSTORE]["ckcc_xpub"] = master_ext_pubkey
|
||||
|
||||
if no_op:
|
||||
if dry_run:
|
||||
pprint.pprint(contents)
|
||||
else:
|
||||
content_str = json.dumps(contents, indent=4)
|
||||
|
||||
@ -25,7 +25,7 @@ def assert_keystore(keystore):
|
||||
|
||||
def test_encrypted():
|
||||
runner = CliRunner()
|
||||
result = runner.invoke(electrum_coldcardify, [encrypted_path, "--no-op"])
|
||||
result = runner.invoke(electrum_coldcardify, [encrypted_path, "--dry-run"])
|
||||
assert result.exit_code == 1
|
||||
assert "Failed to load wallet file" in result.output
|
||||
|
||||
@ -33,7 +33,7 @@ def test_encrypted():
|
||||
def test_no_op():
|
||||
runner = CliRunner()
|
||||
for pth in [ledger_path, trezor_path]:
|
||||
result = runner.invoke(electrum_coldcardify, [pth, "--no-op"])
|
||||
result = runner.invoke(electrum_coldcardify, [pth, "--dry-run"])
|
||||
assert result.exit_code == 0
|
||||
loaded = eval(result.output)
|
||||
assert isinstance(loaded, dict)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user