From 0433daa748c0212c532c888aeb130f31de56b7e3 Mon Sep 17 00:00:00 2001 From: ldericher Date: Mon, 17 Aug 2020 15:21:42 +0200 Subject: [PATCH] neat prompt --- src/kiwi/subcommands/net.py | 4 ++-- src/kiwi/subcommands/utils/user_input.py | 18 ++++++++++++------ 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/src/kiwi/subcommands/net.py b/src/kiwi/subcommands/net.py index 3eb801e..4a5e488 100644 --- a/src/kiwi/subcommands/net.py +++ b/src/kiwi/subcommands/net.py @@ -65,7 +65,7 @@ class NetDownCommand(SubCommand): def run(self, runner, config, args): if not _find_net(config, args): - logging.info(f"Network '{config['network:name']}' already removed") + logging.info(f"Network '{config['network:name']}' does not exist") return True try: @@ -84,4 +84,4 @@ class NetDownCommand(SubCommand): logging.error(f"Error removing network '{config['network:name']}'") return False - return True \ No newline at end of file + return True diff --git a/src/kiwi/subcommands/utils/user_input.py b/src/kiwi/subcommands/utils/user_input.py index 39fff73..51b71e5 100644 --- a/src/kiwi/subcommands/utils/user_input.py +++ b/src/kiwi/subcommands/utils/user_input.py @@ -1,3 +1,11 @@ + +def _surround(string, bang): + midlane = f"{bang * 3} {string} {bang * 3}" + sidelane = bang*len(midlane) + + return f"{sidelane}\n{midlane}\n{sidelane}" + + def are_you_sure(prompt, default="no"): if default.lower() == 'yes': suffix = "[YES|no]" @@ -5,12 +13,10 @@ def are_you_sure(prompt, default="no"): suffix = "[yes|NO]" answer = input( - "!!!!!!!!!!!!!!!!!!\n" - "!!! BE CAREFUL !!!\n" - "!!!!!!!!!!!!!!!!!!\n" - "\n" - f"{prompt}\n" - "\n" + f"{_surround('CAREFULING IN PROGRESS', '!')}\n" + f"\n" + f">>> {prompt} <<<\n" + f"\n" f"Are you sure you want to proceed? {suffix} " ).strip().lower()