Move code out of function into where it should be

This commit is contained in:
Subnet_Masked 2024-02-04 16:52:21 -05:00
parent 53c000cb14
commit a87b03a589
Signed by: Subnet_Masked
GPG key ID: E1BB06A2490954E9

View file

@ -14,7 +14,8 @@ def load_servers():
with open(servers_file,'r') as openfile: with open(servers_file,'r') as openfile:
servers = json.load(openfile) servers = json.load(openfile)
else: else:
create_server(True) print('\n!! Looks like you do not have any servers yet - Let\'s add one.\n')
create_server()
# Write the contents to the servers variable to the servers_file. # Write the contents to the servers variable to the servers_file.
def write_servers(): def write_servers():
@ -42,11 +43,8 @@ def list_servers(mode=int(1)): # make sure a default is set.
index += 1 index += 1
# Creates new server dicts in the server array. # Creates new server dicts in the server array.
def create_server(isfirstrun=False): def create_server():
global servers global servers
if(isfirstrun):
print('\n!! Looks like you do not have any servers yet - Let\'s add one.\n')
print('\n=== Add Server ===') print('\n=== Add Server ===')
srv_name = input('Name: ') srv_name = input('Name: ')
srv_addr = input('Address: ') srv_addr = input('Address: ')