diff --git a/scripts/remove_ledger.py b/scripts/remove_ledger.py index b3f0b2465..c8d36e4cf 100644 --- a/scripts/remove_ledger.py +++ b/scripts/remove_ledger.py @@ -9,16 +9,16 @@ def warn(ledger_name, directories_path): print('The following directories will be deleted:') - + for path in directories_path: print(str(path)) - + print('Deleting a ledger is an irrevocable operation.\nProceed only if you know the consequences.') answer = input('Do you want to delete ledger ' + ledger_name + '?\n Press [y/N]') - + if answer.lower() == 'yes' or answer.lower() == 'y': return True - + return False @@ -29,15 +29,15 @@ def remove(ledger_name): for path in Path(config_helper.ledger_data_dir).rglob(ledger_name + "_*"): directories_path.append(path) - + if not len(directories_path): print('Ledger doesn`t exist: ' + ledger_name) - + elif warn(ledger_name, directories_path): for path in directories_path: shutil.rmtree(str(path)) print('Ledger removed successfully!') - + else: print('Can`t delete built in ledger: ' + ledger_name)