Options to cancel
This commit is contained in:
parent
13b7594b8a
commit
5a9f23f6b6
1 changed files with 17 additions and 6 deletions
|
@ -59,18 +59,29 @@ def pop_server():
|
||||||
global servers # Global so we can write
|
global servers # Global so we can write
|
||||||
print(colored('\n=== Remove Server ===\nPick a server to delete','red'))
|
print(colored('\n=== Remove Server ===\nPick a server to delete','red'))
|
||||||
print(colored(list_servers(2),'light_blue')) # Lists server ID and Name only.
|
print(colored(list_servers(2),'light_blue')) # Lists server ID and Name only.
|
||||||
delete = int(input(colored('?: ','yellow')))
|
delete = input(colored('(enter to cancel) ?: ','yellow'))
|
||||||
servers.pop(delete)
|
if(delete==""):
|
||||||
|
print(colored('Cancelled\n','red'))
|
||||||
|
return
|
||||||
|
servers.pop(int(delete))
|
||||||
|
print(colored('Deleted\n','light_blue'))
|
||||||
write_servers()
|
write_servers()
|
||||||
|
|
||||||
# Let's send some commands to the servers!
|
# Let's send some commands to the servers!
|
||||||
def send_commands():
|
def send_commands():
|
||||||
proceed=True # Used in while loops to determine if we still want to send more commands.
|
proceed=True # Used in while loops to determine if we still want to send more commands.
|
||||||
print(colored('\n=== Send commands ===','green'))
|
print(colored('\n=== Send commands ===','green'))
|
||||||
choice = int(input(colored('Single Server (1) or All (2)?: ','yellow')))
|
choice = input(colored('(Enter to cancel) Single (1) All (2)?: ','yellow'))
|
||||||
if(choice==1): # We only want to interact with one server.
|
if(choice==""):
|
||||||
|
print(colored('Cancelled\n','red'))
|
||||||
|
return
|
||||||
|
if(choice=="1"): # We only want to interact with one server.
|
||||||
print(colored(list_servers(2),'light_blue')) # Show us which servers we can pick from.
|
print(colored(list_servers(2),'light_blue')) # Show us which servers we can pick from.
|
||||||
server = int(input(colored('Server?: ','yellow')))
|
server = input(colored('(Enter to cancel) Server?: ','yellow'))
|
||||||
|
if(server==""):
|
||||||
|
print(colored('Cancelled\n','red'))
|
||||||
|
return
|
||||||
|
server=int(server)
|
||||||
while(proceed):
|
while(proceed):
|
||||||
command = input(colored('Input command (None to exit): ','yellow'))
|
command = input(colored('Input command (None to exit): ','yellow'))
|
||||||
if(command!=""):
|
if(command!=""):
|
||||||
|
@ -81,7 +92,7 @@ def send_commands():
|
||||||
else:
|
else:
|
||||||
proceed = False
|
proceed = False
|
||||||
print(colored('No command was entered. Exiting.\n','red'))
|
print(colored('No command was entered. Exiting.\n','red'))
|
||||||
elif(choice==2):
|
elif(choice=="2"):
|
||||||
while(proceed):
|
while(proceed):
|
||||||
command = input(colored('Input command (None to exit): ','yellow'))
|
command = input(colored('Input command (None to exit): ','yellow'))
|
||||||
for x in servers: # Run for each server.
|
for x in servers: # Run for each server.
|
||||||
|
|
Loading…
Reference in a new issue