diff --git a/multiversx_sdk_cli/cli_config.py b/multiversx_sdk_cli/cli_config.py index 2bd42622..d1439ac2 100644 --- a/multiversx_sdk_cli/cli_config.py +++ b/multiversx_sdk_cli/cli_config.py @@ -1,10 +1,10 @@ import logging import os import sys -from pathlib import Path from typing import Any from multiversx_sdk_cli import cli_shared, config, utils +from multiversx_sdk_cli.ux import confirm_continuation logger = logging.getLogger("cli.config") @@ -106,13 +106,6 @@ def delete_config(args: Any): logger.info(f"Config file not found. Aborting...") return - confirm_continuation(config_file) + confirm_continuation(f"The file `{str(config_file)}` will be deleted. Do you want to continue? (y/n)") os.remove(config_file) logger.info("Successfully deleted the config file") - - -def confirm_continuation(file: Path): - answer = input(f"The file `{str(file)}` will be deleted. Do you want to continue? (y/n)") - if answer.lower().strip() not in ["y", "yes"]: - print("Confirmation not given. Stopping...") - exit(1) diff --git a/multiversx_sdk_cli/ux.py b/multiversx_sdk_cli/ux.py index b91af251..f0177ea6 100644 --- a/multiversx_sdk_cli/ux.py +++ b/multiversx_sdk_cli/ux.py @@ -13,3 +13,10 @@ def show_critical_error(message: str): def show_warning(message: str): print(Panel(f"[yellow]{escape(message)}")) + + +def confirm_continuation(message: str): + answer = input(message) + if answer.lower().strip() not in ["y", "yes"]: + print("Confirmation not given. Stopping...") + exit(1) diff --git a/pyproject.toml b/pyproject.toml index 5d74df73..d550edf7 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "hatchling.build" [project] name = "multiversx-sdk-cli" -version = "9.3.1" +version = "9.4.0" authors = [ { name="MultiversX" }, ]