From a67f991b03862246f7b9bd9c1426dca09cd1775f Mon Sep 17 00:00:00 2001 From: The MMGen Project Date: Mon, 3 Jul 2023 12:42:50 +0000 Subject: [PATCH] mmgen-tool twexport: add `force` keyword arg --- mmgen/tool/rpc.py | 7 +++++-- mmgen/tw/json.py | 6 ++++-- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/mmgen/tool/rpc.py b/mmgen/tool/rpc.py index 8efcba53..a37c7655 100755 --- a/mmgen/tool/rpc.py +++ b/mmgen/tool/rpc.py @@ -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): diff --git a/mmgen/tw/json.py b/mmgen/tw/json.py index a6db12ef..844e28a3 100755 --- a/mmgen/tw/json.py +++ b/mmgen/tw/json.py @@ -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 )