mmgen-tool twexport: add force keyword arg

This commit is contained in:
The MMGen Project 2023-07-03 12:42:50 +00:00
commit a67f991b03
Signed by: mmgen
GPG key ID: 3F8B1861E32B7DA2
2 changed files with 9 additions and 4 deletions

View file

@ -205,7 +205,7 @@ class tool_cmd(tool_cmd_base):
ret = await (await TwCtl(self.cfg,self.proto,mode='w')).rescan_blockchain(start_block,stop_block)
return True
async def twexport(self,include_amts=True,pretty=False,prune=False,warn_used=False):
async def twexport(self,include_amts=True,pretty=False,prune=False,warn_used=False,force=False):
"""
export a tracking wallet to JSON format
@ -224,6 +224,8 @@ class tool_cmd(tool_cmd_base):
If ‘warn_used’ is true, the user will be prompted before pruning used
addresses.
If ‘force’ is true, any existing dump will be overwritten without prompting.
"""
from ..tw.json import TwJSON
await TwJSON.Export(
@ -232,7 +234,8 @@ class tool_cmd(tool_cmd_base):
include_amts = include_amts,
pretty = pretty,
prune = prune,
warn_used = warn_used )
warn_used = warn_used,
force_overwrite = force )
return True
async def twimport(self,filename:str,ignore_checksum=False,batch=False):

View file

@ -167,7 +167,8 @@ class TwJSON:
include_amts = True,
pretty = False,
prune = False,
warn_used = False ):
warn_used = False,
force_overwrite = False ):
if prune and not self.can_prune:
die(1,f'Pruning not supported for {proto.name} protocol')
@ -213,4 +214,5 @@ class TwJSON:
'data': data
},
pretty = pretty ),
desc = f'tracking wallet JSON data' )
desc = f'tracking wallet JSON data',
ask_overwrite = not force_overwrite )