1
0
Fork 0
mirror of https://github.com/yavook/kiwi-scp.git synced 2024-11-22 04:43:00 +00:00

neat prompt

This commit is contained in:
Jörn-Michael Miehe 2020-08-17 15:21:42 +02:00
parent 322033ca92
commit 0433daa748
2 changed files with 14 additions and 8 deletions

View file

@ -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
return True

View file

@ -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()