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): def run(self, runner, config, args):
if not _find_net(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 return True
try: try:

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"): def are_you_sure(prompt, default="no"):
if default.lower() == 'yes': if default.lower() == 'yes':
suffix = "[YES|no]" suffix = "[YES|no]"
@ -5,12 +13,10 @@ def are_you_sure(prompt, default="no"):
suffix = "[yes|NO]" suffix = "[yes|NO]"
answer = input( answer = input(
"!!!!!!!!!!!!!!!!!!\n" f"{_surround('CAREFULING IN PROGRESS', '!')}\n"
"!!! BE CAREFUL !!!\n" f"\n"
"!!!!!!!!!!!!!!!!!!\n" f">>> {prompt} <<<\n"
"\n" f"\n"
f"{prompt}\n"
"\n"
f"Are you sure you want to proceed? {suffix} " f"Are you sure you want to proceed? {suffix} "
).strip().lower() ).strip().lower()