mirror of
https://github.com/yavook/kiwi-scp.git
synced 2024-12-24 18:22:59 +00:00
neat prompt
This commit is contained in:
parent
322033ca92
commit
0433daa748
2 changed files with 14 additions and 8 deletions
|
@ -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
|
||||
|
|
|
@ -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()
|
||||
|
||||
|
|
Loading…
Reference in a new issue